REXX to save all dataset start with (ucat)



REXX to save all dataset start with (ucat)

Postby Sah_97 » Sun Jun 09, 2024 2:13 pm

hello every one .
i have a question i write a rexx to save all dataset start with (ucat ) means ucat* and retrieved informaiton (Tracks, %Used,XT,) and if their XT is larger than 16 save them in output file.

i write a pgm to do that when execute it it woprks but when run it by jcl is returned max-rc 0 but didnt work and dont allocate empty output file :

here is my code :

rexx:

/* REXX */

TRACE OFF
"DELSTACK"
CNT=0
I=0
X=1
USEDSN="'DBKISA3.REP.OUT'"
B='DBKISA3.*'
CALL ALLOCATE_TEMP_DATASET
"ISPEXEC LMDLIST LISTID("NJF") OPTION(FREE)"
"ISPEXEC LMDINIT LISTID("NJF") LEVEL(&B)"
/*
IF RC=0 THEN DO
SAY "* UCAT.TS2TSO * 50 * * * "
SAY "**********************************************************************",
"***********************************************************"
SAY "* DSNAME * EXT_NO * CR_DATE * VOLSER * TRACKS ",
"* USED * REF_DATE * DEF_EXT * EXECUTE_PROGRAM *"
SAY "**********************************************************************" ,
"***********************************************************"
/*
SAY '*****************************************************************'
SAY '* DSNAME * NUMBER OF EXTENTS *'
SAY '*****************************************************************'
*/
END */
DO FOREVER
"ISPEXEC LMDLIST LISTID("NJF") STATS(YES) OPTION(LIST) DATASET(DSVAR)"
IF RC = 0 THEN
DO
QUEUE'* '||LEFT(DSVAR,20)||'* '||LEFT(ZDLEXTX,10)||'* '||LEFT(ZDLCDATE,10),
||'* '||LEFT(ZDLVOL,11)||'* '||LEFT(ZDLSIZE,11)||'* '||LEFT(ZDLUSED,11)||'* ',
||LEFT(ZDLRDATE,10)||'* '||LEFT(DATE(S)||'_'TIME(N),20)

/* SAY'* 'ZDLCDATE
SAY'* 'ZDLVOL
SAY'* 'ZDLSIZE
SAY'* 'ZDLUSED
SAY'* 'ZDLRDATE */
END
ELSE LEAVE
END
TRACE OFF
"ALLOC F(OUT1) DA("USEDSN") MOD REUSE"
"EXECIO * DISKW OUT1 ( FINIS "
"FREE FI(OUT1)"

SAY'****************************'
SAY'* TEMPDS.REPORT UPDATED. *'
SAY'****************************'

/********************************************************************/
/* ALLOCATING TEMP SHARE TEMP DATASETS */
/********************************************************************/
ALLOCATE_TEMP_DATASET:
X=MSG(OFF)
ADDRESS TSO
CREAT_TEMPDS= "ALLOC DSNAME("||USEDSN||") NEW REUSE UNIT(SYSDA)
DSORG(PS) RECFM(F,B) LRECL(140) BLKSIZE(1400) SPACE(15,15) CYL"
ALLOC_OUTPUT_FILE ="ALLOC DD(DATA) DA("||USEDSN||") SHR REUSE"
FREEDSN="FREE DSNAME("||USEDSN||")"
ALLOC_OUTPUT_FILE
IF RC<>0 THEN DO
CREAT_TEMPDS
IF RC<>0 THEN SAY "CREATING INFORMATION DATASET FAILED"
ALLOC_OUTPUT_FILE
PUSH "* DSNAME * EXT_NO * CR_DATE * VOLSER * TRACKS ",
"* USED * REF_DATE * EXECUTE_PROGRAM_DATE *"
"EXECIO * DISKW DATA (FINIS"
"FREE DD(DATA)"
FREEDSN="FREE DSNAME("||USEDSN||")"
FREEDSN
END
FREEDSN
RETURN



my jcl :
//TSOTEST JOB CLASS=A,MSGCLASS=X
//STEP10 EXEC PGM=IKJEFT01,REGION=0M,DYNAMNBR=30,
// PARM='LIST3'
//SYSEXEC DD DSN=DBKISA3.JCLS,DISP=SHR
//SYSTSIN DD DUMMY
//SYSTSPRT DD SYSOUT=*
Sah_97
 
Posts: 3
Joined: Tue May 28, 2024 8:55 pm
Has thanked: 1 time
Been thanked: 0 time

Re: rexxquestion

Postby MrSpock » Thu Jun 13, 2024 3:30 pm

Right off, part of the problem I see is that you're using ISPF services (ISPEXEC) but nowhere in your JCL have you setup and started an ISPF environment.
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: rexxquestion

Postby willy jensen » Thu Jun 13, 2024 7:08 pm

As pointed out by MrSpock, you are using ISPF services, but your JCL do not allocate required ISPF dataset, nor does your parm specify ISPSTART CMD(name).
Something else, it looks like you are missing a RETURN before the ALLOCATE_TEMP_DATASET: label, so I will expect your temp ds to reallocated when you do not expect it.
Last, but certainly not least, please use the CODE tags, your program is rather hard to read due to lack of indentation.
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: rexxquestion

Postby willy jensen » Fri Jun 14, 2024 12:01 am

Sample JCL
//ISP      EXEC PGM=IKJEFT1B,PARM='ISPSTART CMD(XXXX) TEST'    
//SYSEXEC  DD DISP=SHR,DSN=your.local.exec                          
//SYSTSPRT DD SYSOUT=*                                        
//ISPMLIB  DD DISP=SHR,DSN=ISP.SISPMENU                        
//ISPPLIB  DD DISP=SHR,DSN=ISP.SISPPENU                        
//ISPSLIB  DD DISP=SHR,DSN=ISP.SISPSENU                        
//ISPTLIB  DD DISP=SHR,DSN=ISP.SISPTENU                        
//ISPPROF  DD UNIT=SYSDA,SPACE=(TRK,(5,5,4)),RECFM=FB,LRECL=80
//ISPLOG   DD SYSOUT=*,RECFM=VA,LRECL=125,BLKSIZE=129          
//ISPFILE  DD SYSOUT=*,RECFM=FB,LRECL=80,BLKSIZE=6240          
//SYSTSIN  DD *        

I admit that I am not very fond of the expression "ISPEXEC ....". I much prefer either
address IspExec
 "ispf command ...."

or
address IspExec "ispf command ...."

These users thanked the author willy jensen for the post:
Sah_97 (Wed Jun 19, 2024 2:30 pm)
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times


Return to FAQ

 


  • Related topics
    Replies
    Views
    Last post