MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Set Return code depending on the no: of records in a Dataset

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
tattva
Beginner


Joined: 02 Feb 2005
Posts: 97
Topics: 36

PostPosted: Wed May 18, 2005 2:49 pm    Post subject: Set Return code depending on the no: of records in a Dataset Reply with quote

Hi all,

I need to create a REXX which will be embedded inside a jCL. The functionality is :-

1) The Jcl will have a input dataset.

2) REXX utility will have to count the number of lines in the dataset.

3) If the number of lines is in between range(say btw 30 and 100 ),then should the return code to 04)

4) This return code should be the return code of the JCL.

can any one of you let me know if this possible..

Thanks,
Tattva
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed May 18, 2005 2:58 pm    Post subject: Reply with quote

Sure.

Read the first 100 records into a stem variable.

If the value of the stem variable index is > 30 or < 100, exit with rc=4, else exit with rc=0.

Code:

/* REXX */
"EXECIO 100 DISKR indd (STEM rec. FINIS"
If (rec.0 > 30 & rec.0 < 100) Then Exit 4
Else Exit 0
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed May 18, 2005 3:11 pm    Post subject: Reply with quote

Tattva,

You have been on this site for a while and by now you should be able to follow the rules of this forum.

Use meaningful topics (don't use the Forum name for the topic). Avoid putting "urgent" in your topics.

As I mentioned earlier , people on this website share their knowledge voluntarily and you are not doing any good to extract answers from them.

keep in mind that if you repeat the same mistake once again , I will delete the posts as well as you will loose the privileges to post on this board.

Thanks

Kolusu

PS: I am editing the title to reflect the requirement.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tattva
Beginner


Joined: 02 Feb 2005
Posts: 97
Topics: 36

PostPosted: Wed May 18, 2005 3:24 pm    Post subject: Reply with quote

Sorry about that !!! Kolusu!!

Thanks,
Tattva
Back to top
View user's profile Send private message
dtf
Beginner


Joined: 10 Dec 2004
Posts: 110
Topics: 8
Location: Colorado USA

PostPosted: Wed May 18, 2005 3:37 pm    Post subject: Reply with quote

Assuming the file could be either VSAM or QSAM, and this is not known until runtime, is there still a REXX solution?
________
AMC Ambassador history


Last edited by dtf on Tue Feb 01, 2011 1:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed May 18, 2005 4:47 pm    Post subject: Reply with quote

Quote:
Assuming the file could be either VSAM or QSAM, and this is not known until runtime, is there still a REXX solution?


DTF,

yes you can . Actually you do not need rexx to set the return code. You can use IDCAMS RERO with skip and count parms or Print parm to check the number of records

Code:

//*********************************************************************
//*  SETS RC=0000 IF DATASET HAS AT LEAST 15 RECORDS                  *
//*  SETS RC=0004 IF DATASET HAS LESS THAN 15 RECORDS                 *
//*  SETS RC=0012 IF DATASET HAS ZERO RECORDS                         *
//*********************************************************************
//STEP0100 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INPUT    DD DSN=YOUR INPUT FILE,
//            DISP=SHR
//OUT      DD DUMMY
//SYSIN    DD *
 REPRO IFILE(INPUT) OFILE(OUT) SKIP(14) COUNT(1)
/*


Check this link which discusses about handling empty files.

http://www.mvsforums.com/helpboards/viewtopic.php?t=1285&highlight=empty

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
acevedo
Beginner


Joined: 03 Dec 2002
Posts: 127
Topics: 0
Location: Europe

PostPosted: Tue May 24, 2005 9:46 am    Post subject: Reply with quote

Of course Kolusu solution is pefect but my doubt is about the original question:
I need to create a REXX ...
why? this could be done as well in Cobol, Pl1, assembler, easytrieve... why Rexx?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group