3

I have to perform 3 tasks: an insert, a delete, and a write

I'm not sure what the best way to do this is. My mainframe program design skills aren't too tight, so I was looking for advice.

Could I avoid doing a COBOL program for this? The way I see it, I just need JCL that executes SQL statements. If I design my statements correctly, then they should be able to preform tasks 1 and 2 this way. But I'm thinking I may need to have a COBOL program to write to a file? If I do, would I just run through database with a cursor, then process each row and take appropriate action based on the row?

Each task seems similar, but the queries are different and produce different results, so the SQL statements are very different. But they are all working with the same table.

Task 1:

  • preform SQL query
  • For each row that the query picks up
    • Insert a new row based on that row

Task 2:

  • perform SQL query
  • For each row that the query picks up
    • delete the record

Task 3:

  • perform SQL query
  • For each row that the query picks up
    • Write that record to a file
Frantumn
  • 185

1 Answers1

4

You might be able to find some kind of query execution facility that would let you avoid writing much code for task 2 (just executing a DELETE statement), but if you need to reformat, filter or augment data, you're probably going to need to write a program. These are pretty simple tasks, though, so I would bet you can find examples without too much trouble.

TMN
  • 11,383