/*----------------------------------------------------=rexx=----------*/ /* PROFILE EXEC for multiple z/OS guests. */ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* 03/27/2007 - John C. Miller software@jmit.com */ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* This exec is designed to be shared read-only by multiple z/OS VM */ /* guests. The guest name is used to assign a different LOAD */ /* address and LOAD PARMs to use for the IPL. */ /* */ /* Automatic CTC coupling: */ /* For each host, CTC coupling is specified as: 'ctcaddr machine' */ /* This exec will look for CTCs matching ctcaddr, and if found */ /* couple them to 'machine'. A partial CTC address can be coded, in */ /* which case a substring search will be used. */ /* e.g. IF couple = '623 ZOS100' and CTCs 6236-6239 are defined. */ /* Exec will user 6236 and 6237 to link to ZOS100. */ /* If the "couple" entry for a given guest is left blank, then no */ /* automatic CTC coupling will be done. */ /* */ /* This exec automatically runs in one of tow modes: */ /* 1) If running disconnected, which means the guest was AUTOLOG'd, */ /* then the guest is automatically IPL'd. */ /* 2) If the logon is interactive with a human, if the latter, then */ /* the exec prompts the user with a y/n prompt before doing an */ /* IPL. */ /*--------------------------------------------------------------------*/ 'PIPE CP QUERY' userid() '| var user' parse value user with id . dsc . manualparm = ' STOP' nl='15'X ctcb = '' Trace off /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Assign IPL addresses and load parms by guest name. */ /* Also set variable 'couple' to one or more pairs of values to */ /* specify CTCs and machines to couple to. */ /* couple = '62 TCPIP 6240 ZOS100' would look for the first defined */ /* CTC having an address starting with 62xx, and then couple this */ /* machine to ZOS100 via 62xx and 62xx+1. */ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ SELECT WHEN id = 'ZOS101' THEN DO ipladdr = '9150' iplparm = 'LOADPARM 915100' couple = '623 TCPIP' END WHEN id = 'ZOS102' THEN DO ipladdr = '9150' iplparm = 'LOADPARM 915100' couple = '623 TCPIP' END WHEN id = 'ZOS103' THEN DO ipladdr = '9159' ipladdr = '9156' iplparm = 'LOADPARM 915600' couple = '623 TCPIP 6240 ZOS104' END WHEN id = 'ZOS104' THEN DO ipladdr = '915A' ipladdr = '9157' iplparm = 'LOADPARM 915700' couple = '623 TCPIP 6240 ZOS103' END WHEN id = 'ZOS105' THEN DO ipladdr = '9160' iplparm = 'LOADPARM 916000' couple = '623 TCPIP' END WHEN id = 'ZOS106' THEN DO ipladdr = '9150' iplparm = 'LOADPARM 915100' couple = '623 TCPIP' END WHEN id = 'ZOS107' THEN DO ipladdr = '9150' iplparm = 'LOADPARM 915100' couple = '623 TCPIP' END WHEN id = 'ZOS108' THEN DO ipladdr = '9150' iplparm = 'LOADPARM 915100' couple = '623 TCPIP' END WHEN id = 'ZOS001' THEN DO ipladdr = '9024' iplparm = 'LOADPARM 902101' couple = '623 TCPIP' END WHEN id = 'ZOS002' THEN DO ipladdr = '9140' iplparm = 'LOADPARM 914200' couple = '622 TCPIP' END WHEN id = 'ZOS210' THEN DO ipladdr = '914A' iplparm = 'LOADPARM 914A00' couple = '623 TCPIP' END WHEN id = 'ZOS211' THEN DO ipladdr = '914B' iplparm = 'LOADPARM 914B00' couple = '623 TCPIP' END WHEN id = 'ZOS212' THEN DO ipladdr = '914C' iplparm = 'LOADPARM 914C00' iplparm = 'LOADPARM 918100' couple = '623 TCPIP' END WHEN id = 'ZOS213' THEN DO ipladdr = '914D' iplparm = 'LOADPARM 914D00' couple = '623 TCPIP' END OTHERWISE DO ipladdr = 'CMS' iplparm = '' couple = '' END END /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Couple CTCs. */ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ CALL couple_ctcs /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Set up terminal and command environment. */ /* If in DSC status do the IPL without any prompting. */ /* Otherwise ask the user if she wants to IPL. */ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ADDRESS COMMAND nl='15'X 'CP SET RUN ON' 'CP SET PF11 RETRIEVE FORWARD' 'CP SET PF12 RETRIEVE BACKWARD' 'CP TERM BRKKEY PF1' if (dsc = 'DSC') then /* user is disconnected */ 'CP TERM CONMODE 3270' || nl || 'IPL 'ipladdr iplparm else /* user is interactive -> prompt */ do say 'Do you want to IPL zOS? y/n' parse upper pull answer . if (answer = 'Y') then do say 'CP TERM CONMODE 3270' || nl || 'IPL 'ipladdr iplparm 'CP TERM CONMODE 3270' || nl || 'IPL 'ipladdr iplparm /* say 'CP IPL 'ipladdr iplparm manualparm */ /* 'CP IPL 'ipladdr iplparm manualparm */ end end /* else */ exit /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Automatically couple 6xxx CTCs to other machines based on contents */ /* of the 'couple' variable. */ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ couple_ctcs: DO idx = 1 TO WORDS(couple) BY 2 ctc_string = WORD(couple,idx) ctc_machine = WORD(couple,idx+1) ctc_entry = getctc(ctc_string) IF WORDS(ctc_entry) = 2 THEN DO ctc1 = WORD(ctc_entry,1) ctc2 = WORD(ctc_entry,2) 'CP COUPLE 'ctc1 ctc_machine ctc2 'CP COUPLE 'ctc2 ctc_machine ctc1 END END RETURN /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Subr: Get pair of CTC addresses matching a specified string. */ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ getctc: PARSE UPPER ARG #reqctc #len = LENGTH(#reqctc) IF #len = 0 THEN RETURN "" ctcs_assigned = '' /* - - - */ /* Populate var all_ctcs with list of available CTCs. */ /* - - - */ IF VALUE('all_ctcs') = 'ALL_CTCS' THEN DO 'EXECIO * CP (STRING Q V CTC' all_ctcs = '' DO WHILE QUEUED() > 0 pull answer parse var answer type addr dev . IF type <> 'CTCA' THEN ITERATE all_ctcs = all_ctcs addr END END /* - - - */ /* Scan through CTCs looking for first match. */ /* If a match is found, delete that address from eligible CTC list. */ /* - - - */ DO #idx = 1 TO WORDS(all_ctcs) thisctc = WORD(all_ctcs,#idx) qq = #reqctc IF #reqctc <> SUBSTR(thisctc,1,#len) THEN ITERATE ctcs_assigned = thisctc WORD(all_ctcs,#idx+1) LEAVE END /* - - - */ /* Delete the CTCs we just assigned. ctcs_to_delete says which ones. */ /* - - - */ DO #idx1 = 1 TO WORDS(ctcs_assigned) ctc_to_delete = WORD(ctcs_assigned,#idx1) DO #idx2 = 1 TO WORDS(all_ctcs) this_ctc = WORD(all_ctcs,#idx2) IF this_ctc = ctc_to_delete THEN DO all_ctcs = DELWORD(all_ctcs,#idx2,1) LEAVE #idx2 END END END trace off RETURN ctcs_assigned