The sample program shown in the following section processes a base cluster with a discontiguous key alternate index using GVPATH. In this sample, DDnames are passed so that GVPATH can determine which base cluster and alternate index to use. The DDnames BASEDD and AIXDD are allocated when running this sample. This sample appears in SAMPLIB.
Sample
Programs: Two fictitious programs, PROCESS and PRINT, are called in this sample. These program calls are included only for the purpose of showing how to use GVPATH. You should replace these calls with your own code or program calls.
Entry: No required parameters.
Return: A return code of 0 indicates the program was successful; a nonzero return code indicates there was an error. A message is displayed if an error occurs.
TITLE 'PATHSEQ ' PATHSEQ CSECT B AROUND(R15) Go around ---> DC CL8'PATHSEQ' HEXDATE DS 0H AROUND EQU *-PATHSEQ STM R14,R12,12(R13) Save callers regs LR R12,R15 Copy BALR reg for base USING PATHSEQ,R12 LA R14,SAVEAREA Address save area ST R13,4(R14) Chain callers save to own ST R14,8(R13) Chain own save to callers LR R13,R14 Address own save area EJECT *------------------------------------------------------------------- * load gvpath, save entry address *------------------------------------------------------------------- LOAD EPLOC=PATHNAME ST R0,GVPATH@ save address to GVPATH routine *------------------------------------------------------------------- * open path *------------------------------------------------------------------- MVC MODE,SEQUENTIAL processing mode is sequential LA R1,PATHOPEN address open parms L R15,GVPATH@ address GVPATH routine BALR R14,R15 open the path LTR R15,R15 was the open call successful? BNZ ERROR error ---> *------------------------------------------------------------------- * read next record *------------------------------------------------------------------- READNEXT LA R1,PATHREAD address read parms L R15,GVPATH@ address GVPATH routine BALR R14,R15 read the next record via the path LTR R15,R15 was the read successful? BNZ ERROR no, handle the error C R1,EOF end of file from path? BE FINISHED yes, we're done -> L R1,RECORD pass address of base rec to process L R15,=V(PROCESS) (...your processing goes here...) BALR R14,R15 process the record passed from path LTR R15,R15 record successfully processed? BNZ ERROR no ---> B READNEXT continue reading path sequentially *------------------------------------------------------------------- * Processing is complete, call gvpath to close the base and aix *------------------------------------------------------------------- FINISHED DS 0H LA R1,PATHCLOS close aix and base cluster L R15,GVPATH@ address the gvpath routine BALR R14,R15 perform close SR R15,R15 indicate successful run B RETURN return *------------------------------------------------------------------- * Return to caller *------------------------------------------------------------------- RETURN DS 0H L R13,4(,R13) Get callers save area pointer L R14,12(,R13) Get return address LM R0,R12,20(R13) Restore R0 through R12 BR R14 Return to caller ---> *------------------------------------------------------------------- * An error occurred, print message pointed to by R1, return "bad" rc *------------------------------------------------------------------- ERROR DS 0H L R15,=V(DISPLAY) (...print or wto routine here...) BALR R14,R15 display error message LA R15,BADRC indicate that there was an error B RETURN return *------------------------------------------------------------------- * gvpath open parameter list *------------------------------------------------------------------- PATHOPEN DS 0F DC A(PATHOFLG) address of open flag DC A(BASEINFO) address of base information DC A(AIXINFO) address of aix information DC A(MODE) address of processing mode type *------------------------------------------------------------------- * gvpath open parameters *------------------------------------------------------------------- PATHOFLG DC A(4) 4 - indicates an open call to gvpath BASEINFO DS 0H base cluster information follows BASEFLG DC XL1'00' X'00' indicates data set ddname BASEN DC CL8'BASEDD' ddname of base cluster AIXINFO DS 0H alternate index information follows AIXFLG DC XL1'00' aix ddname follows AIXN DC CL8'AIXDD' ddname of the alternate index MODE DS C direct or sequential processing flag *------------------------------------------------------------------- * gvpath read parameter list *------------------------------------------------------------------- PATHREAD DS 0F DC A(PATHRFLG) address of read flag DC A(RECLEN) address of record length field DC A(RECORD) address of record pointer field DC A(0) key parameter is not required for * for sequential processing *------------------------------------------------------------------- * gvpath read parameters *------------------------------------------------------------------- PATHRFLG DC A(8) read flag RECLEN DS F record length field RECORD DS F record address field *------------------------------------------------------------------- * gvpath close parameter list *------------------------------------------------------------------- PATHCLOS DS 0F DC A(PATHCFLG) address of close flag PATHCFLG DC A(12) 12 indicates a close request TITLE 'PATHSEQ - Data Areas' *------------------------------------------------------------------- * Local Data Areas *------------------------------------------------------------------- SAVEAREA DS 18F Save area GVPATH@ DS F address of GVPATH PATHNAME DC CL8'GVPATH' discontiguous key interface name SEQUENTIAL DC C'S' sequential processing indicator DIRECT DC C'D' direct processing indicator EOF DC F'-1' end of file flag *------------------------------------------------------------------- * equates *------------------------------------------------------------------- BADRC EQU 16 bad return code R0 EQU 0 register equates R1 EQU 1 R2 EQU 2 R3 EQU 3 R4 EQU 4 R5 EQU 5 R6 EQU 6 R7 EQU 7 R8 EQU 8 R9 EQU 9 R10 EQU 10 R11 EQU 11 R12 EQU 12 R13 EQU 13 R14 EQU 14 R15 EQU 15 * LTORG END
|
Copyright © 2011 CA.
All rights reserved.
|
|