/* DRCTCOMP - Create USER DIRECT file to be used to migrate user */ /* and profile directory entries from source z/VM system */ /* to the target z/VM system using DIRECTXA */ /* Change Log */ /* */ /* 12/11/12 Modified GETUSER procedure: */ /* Changed: Do until W1='USER' */ /* To: Do until W1='USER' | W1='IDENTITY' */ /* */ /* Runs on the target system */ /* input files */ /* List of profile entries to be migrated - created by exec DIRLIST */ PROFLIST='MIGRATE PROFLST A' /* List of user entries to be migrated - created by exec DIRLIST */ USERLIST='MIGRATE USERLST A' /* Flat file copy of the source z/VM system's user directory */ SOURCEIN='SOURCE DIRECT A' /* Flat file copy of the target z/VM system's user directory */ TARGETIN='TARGET DIRECT A' /* output file - USER INPUT A - becomes input to DIRECTXA or DVHBEGIN */ USERDIR='USER INPUT A' /* call CheckIp to verify that all inout files exist */ Call CheckIp /* erase the output file if it exists */ ADDRESS COMMAND 'ESTATE 'USERDIR If RC = 0 then 'ERASE 'USERDIR /* create a new output file - must have RECFM F */ Say 'Creating 'USERDIR 'EXECIO 1 DISKW 'USERDIR' 0 F 80 (STRING *' /* Get the DIRECTORY and GLOBALDEFS entries */ 'pipe < ' TARGETIN, '| specs 1-72 1', '| pad 80', '| block 80 fixed', '| strtolabel /PROFILE/', '| >> ' USERDIR /* Copy profiles from flat file copy of the target z/VM system's user */ /* directory file to output file */ Say 'Copying Profiles from 'TARGETIN Call GetProfs /* Copy profiles to the output file using the GetDir procedure */ /* Note: profiles must be copied first to insure they are present */ /* when the user entries are processed */ 'pipe < 'PROFLIST' | stem PROFS.' Say 'Merging Profiles from file 'SOURCEIN' into file 'USERDIR Do P = 1 to PROFS.0 NAME=PROFS.P Call GetDir End /* Copy profiles from flat file copy of the target z/VM system's user */ /* directory file to output file */ Say 'Merging Users from file 'TARGETIN' into file 'USERDIR Say 'This process may take several minutes' Call GetUsers /* Copy user entries to the output file using the GetDir procedure */ 'pipe < 'USERLIST' | stem USERS.' Say 'Copying Users from 'SOURCEIN' to file 'USERDIR Do U = 1 to USERS.0 NAME=USERS.U Call GetDir End Say "File "USERDIR" has been created" Exit GetDir: /* extract USER or PROFILE entries from the DIRM WITHPASS file */ /* and place into the output file */ Linein(SOURCEIN,1,0) Do Forever LINE=Linein(SOURCEIN) Parse var LINE W1 W2 . If W1='USER' & W2 = NAME | W1='PROFILE' & W2 = NAME then Do 'pipe var LINE | specs 1-72 1 | pad 80', '| block 80 fixed | >> ' USERDIR Say "Merging " W1 W2 "from file "SOURCEIN" into File " USERDIR Do Forever LINE=Linein(SOURCEIN) 'pipe var LINE | specs 1-72 1 | pad 80', '| block 80 fixed | >> ' USERDIR Parse var LINE L1 . If L1 = "*DVHOPT" then Return End /* copy records loop */ End /* if found loop */ End /* main loop */ Return GetProfs: /* Extract PROFILE entries from the Target System DIRM WITHPASS file */ /* and place into the output file */ Prof_Count=0 Save_Count=0 Linein(TAREGTIN,1,0) Do Until LINES(TARGETIN)=0 | W1='USER' LINE=Linein(TARGETIN) Parse var LINE W1 . If W1='PROFILE' | W1='Profile' then Do 'pipe var LINE | specs 1-72 1 | pad 80', '| block 80 fixed | >> ' USERDIR Prof_Count=Prof_Count+1 /*Do Until LINES(TARGETIN)=0 | W1='*DVHOPT' | W1='USER' */ Do Until LINES(TARGETIN)=0 | W1='USER' LINE=Linein(TARGETIN) Parse var LINE W1 . If W1='PROFILE' | W1='Profile' then Prof_Count=Prof_Count+1 If W1 <> 'USER' then 'pipe var LINE | specs 1-72 1 | pad 80', '| block 80 fixed | >> ' USERDIR If Prof_Count=Save_Count+10 then Do Say Prof_Count" profiles copied so far from "TARGETIN Save_Count=Prof_Count End End End /* copy loop */ End /* Main loop */ Say Prof_Count" profiles copied from file "TARGETIN" to file "USERDIR Return GetUsers: /* Extract USER entries from the Target Systems DIRM WITHPASS file */ /* and place into the output file */ User_Count=0 Save_Count=0 Linein(TARGETIN,1,0) Do until W1='USER'| W1='IDENTITY' LINE=Linein(TARGETIN) Parse var LINE W1 . End 'pipe var LINE | specs 1-72 1 | pad 80', '| block 80 fixed | >> ' USERDIR User_Count=User_Count+1 Do Until LINES(TARGETIN)=0 LINE=Linein(TARGETIN) Parse var LINE W1 . If W1="USER" | W1="IDENTITY" then User_Count=User_Count+1 'pipe var LINE | specs 1-72 1 | pad 80', '| block 80 fixed | >> ' USERDIR If User_Count=Save_Count+10 then Do Say User_Count" users copied from "TARGETIN" so far" Save_Count=User_Count End End Say User_Count" users copied from file "TARGETIN" to file "USERDIR Return CheckIp: /* check for the input files - exit with RC 04 if not found */ IFiles.1=PROFLIST IFiles.2=USERLIST IFiles.3=SOURCEIN IFiles.4=TARGETIN IFiles.0=4 Do C=1 to IFiles.0 ADDRESS COMMAND 'ESTATE 'IFiles.C If RC <> 0 then Do Say 'Input file 'IFiles.C' not found - terminating' Exit 4 End End Return