Comment about conversion to DB2 made by me.
IBM have two COBOL manuals IBM COBOL for z-OS V4.2 Prog Guide.pdf and IBM COBOL for z-OS V4.2 Lang Ref.pdf. The Language Reference can be found at https://www.ibm.com/docs/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/igy3lr50.pdf and Programming Guide can be found at https://www.ibm.com/docs/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/igy3pg50.pdf The programming Guide is very IBM specific so it might not be any use to anyone but I included it for any former IBM programmers.
When I have used SQL in a COBOL program on IBM mainframe it is coded as you see below and a preprocessor will change into COBOL calls to execute the function in a separate step before passing to the compiler. EXEC SQL DECLARE C1 CURSOR FOR SELECT EMP_NO, EMP_NAME, EMP_SALARY FROM EMP ORDER BY EMP_NO END-EXEC. EXEC SQL OPEN C1 END-EXEC.
Thank you Simon. As you say I would not compile production programs with debug options. Graham.
I have copied this from the IBM Programmers Guide. I like to use it so I will know when I have tried to access memory outside of a table. Very good for debugging. The IBM default is NOSSRANGE. “Use SSRANGE to generate code that checks whether subscripts (including ALL subscripts) or indexes try to reference an area outside the region of the table. Each subscript or index is not individually checked for validity; rather, the effective address is checked to ensure that it does not cause a reference...
When I worked with COBOL II you would get an OC6 system error(I think, it's a long time ago) because the hex characters did start with an F. Eg x"F0" for 0. The right most character would start with a C or D depending on whether it was positive or negative.
Hi Steve, This is one I have used. SELECT CMPIndexFile ASSIGN TO CMPIndexFileDisc ORGANIZATION IS INDEXED ACCESS MODE IS DYNAMIC RECORD KEY IS CMP-Company-Number ALTERNATE RECORD KEY IS CMP-Postcode WITH DUPLICATES FILE STATUS IS CMP-STATUS.
Thanks Arnold, Thanks for for your help. I think I've worked out what to do with your help. Graham.