Presentation is loading. Please wait.

Presentation is loading. Please wait.

Positioning the File Pointer and calling programs Fall 2011.

Similar presentations


Presentation on theme: "Positioning the File Pointer and calling programs Fall 2011."— Presentation transcript:

1 Positioning the File Pointer and calling programs Fall 2011

2 SETLL – Positioning the File Pointer Sequential Access File Positions the file pointer at the first record where the key field is greater than on equal to what’s looked for Must be followed by a READ Use %FOUND to determine if the record found is greater than or equal to the key field Use %EQUAL to determine if the record found is exactly the same as the key field that you are looking for

3 SETLL Example /Free setll *loval custmast; read custmast; /end-free

4 SETLL – Example /Free setll custin custmast; if %equal(custmast); exsr validcust; else; exsr invalidcust; endif; /end-free Custno Note Note_dtls 1 1 Customer arrived 1 2 Customer left 3 1 Customer away If Custin = 1, then the file pointer for the first record will be returned

5 SETGT Sequential Access File Positions the file pointer at the first record where the key field is greater than what’s looked for Must be followed by a READ Use %FOUND to determine if the record found is greater than the key field

6 Setgt Example /Free setll custin custmast; if %equal(custmast); exsr validcust; else; exsr invalidcust; endif; /end-free Custno Note Note_dtls 1 1 Customer arrived 1 2 Customer left 3 1 Customer away If Custin = 1, then the file pointer for the last record will be returned

7 Calling Programs Code in pgmA Dfullreport PR EXTPGM(‘REPORT’) /free callp fullreport(); Code in pgmB pgmApgmB No parameters Passed

8 Calling Programs Code in pgmACode in pgmB DDtlreport PR EXTPGM(‘REPORT’)Ddtlreport PR D parm1 10A /freeDdtlreport PI callp Dtlreport(field1);D parm1 10A Code in pgmB pgmApgmB parameters Passed


Download ppt "Positioning the File Pointer and calling programs Fall 2011."

Similar presentations


Ads by Google