For this sample, GVBLDIX uses the following control statements:
BASE=BASE.CLUSTER.NAME AIX=AIX.NAME KEYS(13 0) KEYS(6 330)
The KEYS (length offset) parameter in the DEFINE of the alternate index should have a length of 19 (sum of the discontiguous keys) and an offset of 0 (the offsets are determined by the parameters to GVBLDIX). The sum of the discontiguous key lengths must equal the length specified in the DEFINE KEYS parameter of the alternate index. The offsets in the GVBLDIX KEYS(length offset) parameter are the offsets in the base record of the desired fields. In this case, the offset to the catalog name is 0 and the offset to the data volser is 330.
Sample
In the following sample, GVPATH uses the discontiguous key CATALOG.USERCMVS001 to return all clusters owned by CATALOG.USERC that have a data component on MVS001.
Programs: Two fictitious programs, PROCESS and PRINT, are called in this sample. These program calls are included only to show 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 'PATHDIR ' CSECT B AROUND(R15) Go around ---> DC CL8'PATHDIR' HEXDATE DS 0H AROUND EQU *-PATHDIR STM R14,R12,12(R13) Save callers regs LR R12,R15 Copy BALR reg for base USING PATHDIR,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,DIRECT 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 test return code BZ FOUND record found -> B DISPLMSG no, display message returned *-------------------------------------------------------------- * record found, check to see if there are more records. If r1 * contains a 4, this means a there are more base records for this * particular discontiguous aix key (non-unique aixs only). To read * the next base record for this key, pass the aix key again. *--------------------------------------------------------------- FOUND DS 0H C R1,MORERECS more base recs for this aix key? BE SET_FLAG yes -> MVI MRECFLG,X'00' no more records follow this one B PROCESS process the last record for this key SET_FLAG DS 0H OI MRECFLG,YES indicate that there are more records B PROCESS process current record *--------------------------------------------------------------- *process base record *--------------------------------------------------------------- PROCESS DS 0H 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 ---> TM MRECFLG,YES are there more recs? BO READNEXT continue reading path sequentially B FINISHED no more recs...we're finished *---------------------------------------------------------------- * 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(PRINT) (...print or wto routine here...) BALR R14,R15 display error message LA R15,BADRC indicate that there was an error B RETURN return *----------------------------------------------------------------- * A nonzero return code could be a record not found condition, * the message should be printed and processing could continue. * This could be done by checking for a return code of 8, printing * the message pointing to next key and returning to READNEXT. * If the return code is 16, just go to error. * For this example though, go to error... *------------------------------------------------------------------ DISPLMSG DS 0H B ERROR *------------------------------------------------------------------ * 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'80' X'80' indicates data set name BASEN DC CL44'BASE.CLUSTER.NAME' must be left justified padded AIXINFO DS 0H alternate index information follows PAT01670 AIXFLG DC XL1'80' aix name follows AIXN DC CL44'AIX.NAME' left justified padded with blanks 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(DISCKEY) address of discontiguous aix key *------------------------------------------------------------------- * gvpath read parameters *------------------------------------------------------------------- PATHRFLG DC A(8) read flag RECLEN DS F record length field RECORD DS F record address field DISCKEY DC C'CATALOG.USERCMVS001' key = catalog name volser *------------------------------------------------------------------- * gvpath close parameter list *------------------------------------------------------------------- PATHCLOS DS 0F DC A(PATHCFLG) address of close flag PATHCFLG DC A(12) 12 indicates a close request TITLE 'PATHDIR - Data Areas' *-------------------------------------------------------------------- * Local Data Areas *-------------------------------------------------------------------- SAVEAREA DS 18F Save area GVPATH@ DS F address of GVPATH COUNTER DS F 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 MORERECS DC F'4' a rc of 4 indicates more records MRECFLG DS XL1 00 - indicates no more base recs YES EQU X'80' 80 - indicates more base recs for * for the current aix key *------------------------------------------------------------------- * 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.
|
|