View previous topic :: View next topic
|
Author |
Message |
Bahugun
New User
Joined: 07 Jul 2010 Posts: 24 Location: hyderabad
|
|
|
|
I have a job which validates a file. A PROC in the job validates whether the file is empty or not. If the file is empty it gives the RC=4 else it gives the return code as RC=0. I want to create a log in the spool(SYSOUT), when the input file is empty. How it can be acheived? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Use a COBOL program to DISPLAY UPON CONSOLE your desired text message, or use a WTO (Write To Operator) macro. |
|
Back to top |
|
|
Bahugun
New User
Joined: 07 Jul 2010 Posts: 24 Location: hyderabad
|
|
|
|
i do not want the cobol code to be changed.i need some process which can be used in jcl/PROC itself,& send the message to the spool. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
But in any case (COBOL code or some utility) you would need to alter the PROC/JCL? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What utility is being used to generate the rc=0 or rc=4?
You might consider writing the utility output to the spool. . . |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
Back to top |
|
|
Bahugun
New User
Joined: 07 Jul 2010 Posts: 24 Location: hyderabad
|
|
|
|
thanks for the help.the following coding helped me solve the issue.
// IF (STEP048.RC EQ 4) THEN
//STEP65 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT1 DD DSN=TSUE76Z.MMC.SC2JULY.JCLPARM(EMPTY),DISP=SHR
//SYSUT2 DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
// ENDIF
//*the parameter EMPTY has the string "file is
//*empty"
this can be used in proc. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear you have a solution - thank you for posting it
d |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Can I ask why it is so important to display this in the spool.
Surely if you used IDCAMS as the tool to see if a dataset (a) exists and / or (b) if it is populated then all of the results would be displayed in the SYSPRINT of the IDCAMS step and be clearly visible to all and sundry.
All so easy and controllable.
If the dataset exists and is populated the RC will be 0.
If the dataset exists and is empty we get RC = 4.
If the dataset does not exist then RC = 8.
Code: |
//SYSIN DD *
LISTCAT ENT('MY DATASET NAME')
IF MAXCC EQ 0 THEN PRINT IDS('MY DATASET NAME') COUNT(1)
ELSE SET MAXCC EQ 8 |
Call me old fashioned but I can never remember having to go through all of this circus act with dataset exists, dataset is populated rubbish. Everything was dealt with by the program and JCL to ensure that all datasets did exist and if they were empty then the program dealt with it.
Just can not understand why programs and JCL can not work together like they did in the good old days when things were done properly. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Expat,
I am old fashioned as well. I always write my programs to handle empty input files.
But in many of our cases we still check for data existence and alter JCL flow accordingly.
The reason is:
1) If there is data, we backup the file to a gdg. We would not want to do that for empty files because 7 out of ten would be empty (for example). Empty gens would push populated gens off too soon. Going back to find actual data would be more difficult.
2) After the program is run , emails and transmissions are sent. We do not want to send either if there was no data to process.
So you see, one simple existence check can save much unneeded processing. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Expat,
Quote: |
Just can not understand why programs and JCL can not work together like they did in the good old days when things were done properly. |
Because more and more of the people being hired do not have proper training let alone qualified mentors.
d |
|
Back to top |
|
|
|