gtpg2m5m | General Macros |
Use this general macro to position access for subsequent sequential or keyed retrieval. This macro is useful in partitioning scans of large databases; for example, an entry control block (ECB) can scan a range of keys starting at a discrete point in the file.
Format
|
Entry Requirements
Return Conditions
Programming Considerations
Examples
In the following example, the VPNTC macro positions at the first record that has a key greater than or equal to 5555. The program then scans the database from that point.
. . . VGENC BLK=ACB, Generate an ACB DDNAME=DDNAME, ..DDname MACRF=(KEY,SEQ,IN) ..Options BNZ ERROR Process Errors LR R6,R14 Save ACB pointer in R6 MVC EBW000(4),KEYVALUE Setup search key argument VGENC BLK=RPL, Generate an RPL AM=VSAM, ..Access method is VSAM ACB=(R6), ..ACB pointer is in R6 LEVEL=D3, ..Data Level is D3 ARG=EBW000, ..Search argument starts here OPTCD=(KEY,SEQ,KGE,FKS) ..Key search, sequential access, ..search for key >= arguments, ..do full key search BNZ ERROR Process Errors LR R7,R14 Save RPL pointer in R7 VOPNC ACB=(R6) Open file BNZ ERROR ..Open error VPNTC RPL=(R7) Position for start of SCAN BNZ ERROR ..locate error SCAN DS 0H VGETC RPL=(R7) Retrieve next record BNZ ENDSCAN ..Assume End of Data ... otherwise process record B SCAN Continue scan . . . DDNAME DC CL8'TRANSLOG' Data Definition Name KEYVALUE DC CL4'5555' Search Key value