SYSUSED is not working while runnign with JCL

Ask/Clarify the questions on TSO, CLIST & REXX

Moderators: Veera, Moderator Group

mainframes.rajiv
Member
Posts: 13
Joined: Wed Mar 14, 2012 8:18 pm

SYSUSED is not working while runnign with JCL

Post by mainframes.rajiv » Wed Mar 14, 2012 8:43 pm

Hello, I am new to forum and REXX as well.

I wrote a code which use LISTDSI function of REXX and from the return of this Function Like SYSUSEDPAGES,SYSPRIMARY,SYSSECONDS,SYSUSED,SYSMEMBERS I am doing some utilization calculations. It working absolutely fine when i am running it implicitly / explicitly and writing the desired output in the file.

but when i am trying to run this with the JCL then any parameter returning me nothing, hence my airthmetic operations getting failed.
Can some one pls help to correct this.

JCL I am running

//ZDELETE1 EXEC PGM=IKJEFT01,COND=(0,NE)
//SYSEXEC DD DSN=MYID.MYREXX,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//OUTFILE DD DISP=OLD,DSN=MY.HOUSEKP.DSNINFO.RPT
//SYSTSIN DD *
%TEST
//INFILE DD DISP=SHR,DSN=MY.HOUSEKP.DSNINFO
/*


REXX I am running

( I have shortern the code of rexx, if this will successfull then my whole code will be fine i believe)
/*REXX*/
INFO = LISTDSI('THIS.IS.MYPDS)
SAY 'SYSUSED IS 'SYSUSED
Thanks
Rajiv

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Mar 14, 2012 8:58 pm

I have shortern the code of rexx, if this will successfull then my whole code will be fine i believe
no you are wrong.

first of all,
i imagine that you have no code to check the return from any functions or services

Code: Select all

IF RC <> 0 THEN
  DO
    SAY 'RETURN FROM ... NOT 0'
    EXIT
  END
otherwise you would have seen a message in your sysout.
more than likely, you are requesting a service
that requires some libraries
and you don't have any.....
but you have decided that you are sooooo clever,
you do not need to show us your REXX Script.

great, i don't want to look at it anyway,
do a search on 'running rexx in batch'
in google.
or read the manual concerning running rexx scripts in batch.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Wed Mar 14, 2012 9:04 pm

I don't know, I get the same results either way. I do know that the REXX code you posted is syntactically incorrect, and doesn't look right to begin with. A LISTDSI for a specific dataset is usually coded:

INFO = LISTDSI("'MY.DATASET'")

with the dataset fully qualified with the TSO convention of single quotes, and then surrounded by the double quotes.

or, if the dataset name is a variable,

DSN = MY.DATASET
INFO = LISTDSI("'"DSN"'")

I think the only way it can work as you posted is if TSO PROFILE PREFIX(youruserid) is active.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Mar 14, 2012 9:09 pm

MrSpock,

keep in mind he has probably typed and not cut and pasted.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

mainframes.rajiv
Member
Posts: 13
Joined: Wed Mar 14, 2012 8:18 pm

Post by mainframes.rajiv » Wed Mar 14, 2012 11:09 pm

Apology Dick, but my intention was not like to hide the REXX code .. I was trying to make it simple so that it can be understandable.

i am getting the output in SYSOUT

SYSUSED IS
and then nothing, when i am running the same via EX in front of the member then i am getting some real value.

/*REXX*/
X = LISTDSI("PPT11FBN.M02323.HISNDM")
IF X =0
THEN DO
SAY `SYSUSEDPAGES IS`SYSUSEDPAGES
END
EXIT

please help to understand this , how can i get the desired output.
Thanks
Rajiv

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Thu Mar 15, 2012 7:25 am

PPT11FBN.M02323.HISNDM should be enclosed in single quotes, as you would any dataset in TSO, 'PPT11FBN.M02323.HISNDM'

then, the entire string should be surrounded by double quotes to avoid possible translation as a variable,

X = LISTDSI( double-quote single-quote PPT11FBN.M02323.HISNDM single-quote double-quote )

mainframes.rajiv
Member
Posts: 13
Joined: Wed Mar 14, 2012 8:18 pm

Post by mainframes.rajiv » Thu Mar 15, 2012 7:12 pm

Thanks MrSpoc and all for replying, thanks it solved my problem with the one file(PDS/E) name.but when i am trying to run my program in loop using STEM Variablle. its returning me nothing. and hence its getting failed in Airthmetic operation.

can you please help me in that as well.

this is my REXX code
/*REXX*/
UID=SYSVAR(SYSUID)
"DELETE '"||UID||".JCLLIB.UTI'"
"ALLOC DSNAME('"||UID||".JCLLIB.UTI') NEW CAT RECFM(F B) LRECL(133)",
"CYL SPACE(1,1)"
"ALLOC F(INFILE) DA('MY.HOUSEKP.DSNINFO') SHR"
"ALLOC F(OUTFILE) DA('"||UID||".JCLLIB.UTI') OLD REUSE"
"NEWSTACK"
"EXECIO * DISKR INFILE (STEM VAR. FINIS"
DO I =1 TO VAR.0
INFO = LISTDSI(VAR.I)
IF SYSUSED = "N/A" THEN
DO
IF SYSUNITS = "CYLINDER" THEN KB = 182
IF SYSUNITS = "TRACK" THEN KB = 12
USED=(SYSUSEDPAGES*100)/((SYSPRIMARY+(SYSSECONDS*123))*KB)
Y = ' PDSE'
END
ELSE
SAY 'THIS IS A PDS'


This is my output, what i am getting

1READY
%TEST
28 +++ USED=((SYSUSED*KB)*100)/((SYSPRIMARY+(SYSSECONDS*15))*KB)
IRX0041I Error running TEST, line 28: Bad arithmetic conversion
IKJ56500I COMMAND FILE NOT FOUND
IKJ56621I INVALID COMMAND NAME SYNTAX
READY
END
Thanks
Rajiv

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Thu Mar 15, 2012 7:31 pm

Please post a trace. Thanks.

mainframes.rajiv
Member
Posts: 13
Joined: Wed Mar 14, 2012 8:18 pm

Post by mainframes.rajiv » Thu Mar 15, 2012 9:11 pm

REXX

/*REXX*/
UID=SYSVAR(SYSUID)
"ALLOC F(INFILE) DA('HIS.HOUSEKP.DSNINFO') SHR"
"ALLOC F(OUTFILE) DA('"||UID||".JCLLIB.UTI') SHR"
"NEWSTACK"
"EXECIO * DISKR INFILE (STEM VAR. FINIS"
DO I =1 TO VAR.0
INFO = LISTDSI(VAR.I)
/* ANY AIRTHMETIC OPERATION */
SAY 'SYSUSED :'SYSUSED
X = SYSUESD*1
END


ok, here it is
please see Bad arithmetic conversion


1READY
%TEST
3 *-* UID=SYSVAR(SYSUID)
>L> "SYSUID"
>F> "I023230"
4 *-* "ALLOC F(INFILE) DA('HIS.HOUSEKP.DSNINFO') SHR"
>L> "ALLOC F(INFILE) DA('HIS.HOUSEKP.DSNINFO') SHR"
5 *-* "ALLOC F(OUTFILE) DA('"||UID||".JCLLIB.UTI') SHR"
>L> "ALLOC F(OUTFILE) DA('"
>V> "I023230"
>O> "ALLOC F(OUTFILE) DA('I023230"
>L> ".JCLLIB.UTI') SHR"
>O> "ALLOC F(OUTFILE) DA('I023230.JCLLIB.UTI') SHR"
IKJ56246I DATA SET I023230.JCLLIB.UTI NOT ALLOCATED, FILE IN USE
+++ RC(12) +++
6 *-* "NEWSTACK"
>L> "NEWSTACK"
7 *-* "EXECIO * DISKR INFILE (STEM VAR. FINIS"
>L> "EXECIO * DISKR INFILE (STEM VAR. FINIS"
8 *-* DO I =1 TO VAR.0
>L> "1"
>V> "91"
9 *-* INFO = LISTDSI(VAR.I)
>C> "VAR.1"
>V> "pca7t011.ADBS.JCLLIB.ARCHIVE
"
>F> "16"
10 *-* /* ANY AIRTHMETIC OPERATION */
11 *-* SAY 'SYSUSED :'SYSUSED
>L> "SYSUSED :"
>V> ""
>O> "SYSUSED :"
SYSUSED :
12 *-* X = SYSUESD*1
>L> "SYSUESD"
>L> "1"
12 +++ X = SYSUESD*1
IRX0041I Error running TEST, line 12: Bad arithmetic conversion
READY
END
Thanks
Rajiv

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Mar 15, 2012 9:52 pm

you don't have and FREEs,
you never check the RC

how do you expect to debug this thing if you don't internally
(with your code)
check for errors?

also,
if you are running this in batch,
and your jcl for the step is as you provided in your first post,
you don't need to ALLOC your INFILE and OUTFILE.
i would suggest that you remove the DD statements from your JOB.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

mainframes.rajiv
Member
Posts: 13
Joined: Wed Mar 14, 2012 8:18 pm

Post by mainframes.rajiv » Thu Mar 15, 2012 11:01 pm

Thanks , I did that you mentioned. but still i am getting Bad Arithmetic error.
think we need to look at the way to mention VAR.I so that it can be accepted by LISTDSI when running thru JCL
Thanks
Rajiv

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Mar 15, 2012 11:25 pm

at least attempt to do what MrSpock suggested:

X = LISTDSI( double-quote single-quote PPT11FBN.M02323.HISNDM single-quote double-quote )
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Fri Mar 16, 2012 2:08 am

Or, as I mentioned, and as is repeated in the REXX manuals, for a variable that contains a dataset name, it's:

INFO = LISTDSI("'"VAR.I"'")

or

INFO = LISTDSI( double-quote single-quote double-quote variable_name double-quote single-quote double-quote )

mainframes.rajiv
Member
Posts: 13
Joined: Wed Mar 14, 2012 8:18 pm

Post by mainframes.rajiv » Fri Mar 16, 2012 3:30 pm

Thanks for your help MrSpoc, really appericiate.
seems i am near and getting the below error now
can you please suggest a good book for REXX beginers (hardcopy)
thanks again

1READY
%TEST
IKJ56246I DATA SET HIS.HOUSEKP.DSNINFO.NEW NOT ALLOCATED, FILE IN USE
IKJ56709I INVALID DATA SET NAME, 'BCA07T11.ADBS.JCLLIB.ARCHIVE
IKJ56709I INVALID DATA SET NAME, '
15 +++ Y = SYSUSED + 1
IRX0041I Error running TEST, line 15: Bad arithmetic conversion
READY
END
Thanks
Rajiv

mainframes.rajiv
Member
Posts: 13
Joined: Wed Mar 14, 2012 8:18 pm

Post by mainframes.rajiv » Sat Mar 17, 2012 2:24 pm

some one pls help me on this. bit urgent

1READY
%TEST3
2
IKJ56709I INVALID DATA SET NAME, 'JHA07T11.INTA.JCLLIB
IKJ56709I INVALID DATA SET NAME, '
LIST 16
9 +++ Y = SYSUSED + 1
IRX0041I Error running TEST3, line 9: Bad arithmetic conversion
READY
END


/*REXX*/
"ALLOC F(IN) DA('HIS.HOUSEKP.DSNINFO.NEW') SHR"
"EXECIO * DISKR IN (STEM VAR. FINIS"
"FREE F(IN)"
SAY VAR.0
DO I =1 TO VAR.0
LIST = LISTDSI("'"VAR.I"'")
SAY 'LIST 'LIST
Y = SYSUSED + 1
SAY 'SYSUSED + 1 :'Y
END
EXIT
Thanks
Rajiv

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others