View previous topic :: View next topic
|
Author |
Message |
pankaj1002
New User
Joined: 30 Jul 2012 Posts: 18 Location: India
|
|
|
|
Hi Guys,
I got one requirement to get total records of a file and then based on those count, I have to execute step2 or step3.
I am able to get the count using below code snippet. Is it possible to capture the count in Symbolic parameter, so that I can use IF/ELSE criteria to run below steps??
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=.... input file,DISP=SHR
//OUT DD SYSOUT=*
//TOOLIN DD *
COUNT FROM(IN) WRITE(OUT) DIGITS(8)
/*
~~~~ trying to implement below thing ~~~~
// IF COUNTNUM=100 THEN
//STEP02
...
// ELSE
//STEP03 |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
no,
but you could set the RC.
use cond codes instead of IF/THEN/ELSE, also. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Possibly you can make use of SYMNAMES from SORT product. Which SORT product are you using at your shop? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
HTF are going to get this to work:
IF COUNTNUM=100 |
|
Back to top |
|
|
pankaj1002
New User
Joined: 30 Jul 2012 Posts: 18 Location: India
|
|
|
|
dbzTHEdinosauer wrote: |
no,
but you could set the RC.
use cond codes instead of IF/THEN/ELSE, also. |
Ok..but how we will SET MAXXCC depending on record counts? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
I overlooked that part from original post... |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you are using sort (either syncsort or DFSORT).
both can set the RC based on a count.
check/search the forum(s) (jcl for synsort/DFSORT for <guess>)
maxcc is something else. check the JCL manual and learn the difference. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Very good point Dick
Possibly this will be a distraction, but maybe it is time to say this once again. . . .
Although many posters here use RETURN CODE, RC, Condition Code, and MAXCC interchangably - THEY ARE NOT.
MAXCC is completely different and should only be mentioned when using a utility that has this - most often IDCAMS.
Note that MAXCC is not ever referenced in the JCL manuals. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
is COUNTNUM always going to be 100 ?
Gerry |
|
Back to top |
|
|
pankaj1002
New User
Joined: 30 Jul 2012 Posts: 18 Location: India
|
|
|
|
gcicchet wrote: |
Hi,
is COUNTNUM always going to be 100 ?
Gerry |
Yes Gerry COUNTNUM will be a constant value and will not change |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
This is what I came up with using Syncsort/Synctool and assuming that it wants the count to be exactly 100:
Code: |
//STEP001 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...
//OUT DD DSN=&&T1,DISP=(,PASS),UNIT=VIO,SPACE=(CYL,(1,1))
//CNT DD DSN=&&T2,DISP=(,PASS),UNIT=VIO,SPACE=(CYL,(1,1))
//TOOLIN DD *
COUNT FROM(IN) WRITE(OUT) DIGITS(8)
COPY FROM(OUT) TO(CNT) USING(CTL1)
COUNT FROM(CNT) EMPTY RC4
/*
//CTL1CNTL DD *
OUTFIL INCLUDE=(1,8,ZD,EQ,100)
/*
//*
// IF STEP001.RC = 0 THEN
//STEP002 EXEC PGM=IEFBR14
// ENDIF
|
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
this might be slightly simpler
Code: |
//STEP0001 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=input dsn
//TOOLIN DD *
COUNT FROM(IN) EQUAL(100) RC4
/*
|
Gerry |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Further simplification. Sets RC to 12 by default. If 12 is not too "scary"... :-)
Code: |
//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=input dsn
//TOOLIN DD *
COUNT FROM(IN) EQUAL(100)
/*
|
The RC of 12 or 4 works with EMPTY, NOTEMPTY, HIGHER(x), LOWER(y), EQUAL(v), or NOTEQUAL(w), so able to cover a wide range of situations and not just limited to an exact value. SUB and ADD are available for adjusting the count prior to testing, if needing to deal with presence/addition of headers, trailers or some such.
...with DFSORT's ICETOOL, anyway :-)
Check your Synctool Docu... oh, you probably can't :-) |
|
Back to top |
|
|
pankaj1002
New User
Joined: 30 Jul 2012 Posts: 18 Location: India
|
|
|
|
Thanks All for your inputs ,
The final code which worked for me is:
Code: |
//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INPFILE DD DSN=FILENAME
//TOOLIN DD *
COUNT FROM(INPFILE) EQUAL(100) RC4
/*
|
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Thanks for letting us know.
Now that we know what you wanted, I've edited your subject :-) |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Bill Woodger wrote: |
Now that we know what you wanted, I've edited your subject :-) |
And I wondered how the "contents of other topic" are exactly same of "a previous topic".
Thanks actually, it was indeed confusing. |
|
Back to top |
|
|
|