/*********************************************************************/ /***** REXXPOW: ******/ /*********************************************************************/ /***** REXX program to copy a POWER queue entry in LST or PUN ******/ /***** queue. ******/ /***** To avoid consumption of much GETVIS storage especially ******/ /***** for large queue entries, copy processing can be broken ******/ /***** into pieces. Constant part_size determines the number ******/ /***** of records to be copied at once. ******/ /***** To give an idea of the specification possibilities for ******/ /***** PUTQE, all optional PUTQE operands are defined. ******/ /*********************************************************************/ /************************ initializations ****************************/ Trace o RC=0 queue = 'LST' /* queue type: LST or PUN */ job_name = 'RXLSTCAT' /* name of entry to be copied */ job_number = '02808' /* number of entry to be copied */ class = 'A' /* class of entry to be copied */ user = 'USCH' /* FROM/TO user of entry to be cop.*/ part_size = 100 /* record # to be copied at once */ new_jobname = 'NEWNAME' /* name of entry to be created */ new_class = 'N' /* class of entry to be created */ new_copies = 2 /* number of copies */ new_destuser = 'BRAUNU' /* TO user */ new_disp = 'L' /* disposition */ new_jsep = 3 /* number of job separator pages */ new_priority = 5 /* output priority */ new_userinfo = 'this_is_a_copy' /* user information */ SIGNAL ON ERROR SETUID user /* UserId for POWER queue entry */ y = OUTTRAP('RET.',,'NOCONCAT') /* space for return info from POWER*/ ADDRESS POWER /* switch to POWER host command env*/ /***************** determine number of records ***********************/ If queue = 'LST' Then Do /* FORMAT specification / LST queue*/ getqe_format = 'FORMAT print_format CTRLREC' End Else Do getqe_format = '' End 'GETQE' queue 'JOBNAME' job_name 'JOBNUM' job_number , 'CLASS' class , getqe_format , 'RECORDS record_number' Call ERROR_CHECKING /* check for processing errors */ /*** Number of records has been returned in variable record_number ***/ If queue = 'LST' Then Do /*specifications for LST queue only*/ putqe_format = 'FORMAT' print_format /* FORMAT specification */ new_optb.0 = 1 new_optb.1 = 'CICSDATA=HUGO02' putqe_optb = 'OPTB new_optb.' /* OPTB specification */ End Else Do putqe_format = '' putqe_optb = '' End /*********** write first part of queue entry: 0 records ************/ entry_part.0 = 0 'PUTQE' queue 'FIRST JOBNAME' new_jobname 'JOBNUM new_jobnum' , 'CLASS' new_class , 'COPIES' new_copies , 'DESTUSER' new_destuser , 'DISP' new_disp , 'JSEP' new_jsep , 'PRIORITY' new_priority , 'USERINFO' new_userinfo , putqe_optb , putqe_format , 'STEM entry_part.' Call ERROR_CHECKING /* check for processing errors */ /*************** copy all parts of the queue entry *****************/ Do i = 1 To ((record_number + part_size - 1) % part_size) /************ read next portion of POWER queue entry *************/ 'GETQE' queue 'JOBNAME' job_name 'JOBNUM' job_number , 'CLASS' class , getqe_format , 'STEM entry_part.' , 'STARTREC' ((i-1)*part_size)+1 'RECORDS' part_size Call ERROR_CHECKING /* check for processing errors */ /************ write next portion of POWER queue entry ************/ 'PUTQE' queue 'NEXT JOBNAME' new_jobname 'JOBNUM' new_jobnum , 'CLASS' new_class , putqe_format , 'STEM entry_part.' Call ERROR_CHECKING /* check for processing errors */ End /******* write last portion of POWER queue entry: 0 records ********/ entry_part.0 = 0 'PUTQE' queue 'LAST JOBNAME' new_jobname 'JOBNUM' new_jobnum , 'CLASS' new_class , putqe_format , 'STEM entry_part.' Call ERROR_CHECKING /* check for processing errors */ /********************** successful return **************************/ EXIT 0 ERROR_CHECKING: /*************** check return information from POWER *****************/ If RC ^= 0 Then EXIT RC /* stop processing, if unsuccessful*/ If RET.0 ^= 0 Then Do; /* POWER return info available? */ Say 'POWER return information:' /* print POWER return information */ Do i = 1 To RET.0 Say RET.i End EXIT 4 /* stop processing in this case */ End Else RETURN /* else continue */ ERROR: /* general error exit */ RetCode = RC Say Sourceline(SIGL) Say 'The return code from the command on line' SIGL 'is' RC EXIT RetCode