Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Conditional JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
jr3011

New User


Joined: 17 Apr 2008
Posts: 26
Location: Oviedo, FL

PostPosted: Thu May 31, 2012 10:50 pm    Post subject: Conditional JCL
Reply with quote

Does DFSORT pass anything (return code for example) when no records are selected that i can use in conditional jcl to bypass a block of jcl ? If no records are created in my output file i don't want to email the output file.
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu May 31, 2012 10:59 pm    Post subject:
Reply with quote

Please check here

Also how is your input file created so that if nothing is written cant you set the return code there ( Just to check if you create your input using any program apart from sort )
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu May 31, 2012 11:11 pm    Post subject:
Reply with quote

And also refer to NULLOFL and NULLOUT

NULLOUT applies to the SORTOUT data set. NULLOFL applies to OUTFIL data sets

Thanks,
Back to top
View user's profile Send private message
jr3011

New User


Joined: 17 Apr 2008
Posts: 26
Location: Oviedo, FL

PostPosted: Thu May 31, 2012 11:40 pm    Post subject: NULLOFL
Reply with quote

thanks alot, this works for me..
Back to top
View user's profile Send private message
jr3011

New User


Joined: 17 Apr 2008
Posts: 26
Location: Oviedo, FL

PostPosted: Fri Jun 01, 2012 6:21 pm    Post subject: return code
Reply with quote

it sets the return code fine (CC=04) ... but i get a jcl error (invalid referback) on the IF statement.

I have tried the following IF statements
IF SORT.RC = 0 then
IF STEP1. RC = 0 then


//STEP1 EXEC SORT
//SORTIN DD DSN=TEMP.JRH.MANUAL,DISP=(SHR)
//SORTOF1 DD DSN=&&CHEPEML,DISP=(NEW,PASS)
//SYMNAMES DD DSN=CTLCDS.DUDA(SYMNAMES),DISP=SHR
//SYSIN DD DISP=SHR,DSN=CTLCDS.DUDA(ODSA29)
// IF SORT.RC = 0 THEN
//MAILIT EXEC MAILREPT
//MFMAIL.REPORT DD DSN=&&CHEPEML,DISP=(OLD,DELETE)
//MFMAIL.SYSTSIN DD *
%XMITIP (JRH@DUDA.COM) NOMSG FILEDD REPORT -
SUBJECT 'CHEP PALLETS FOR REVERSAL' -
MSGT 'SEE ATTACHMENT FOR REPORT'
// ENDIF
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Jun 01, 2012 6:29 pm    Post subject:
Reply with quote

why two if and one end if?
Back to top
View user's profile Send private message
jr3011

New User


Joined: 17 Apr 2008
Posts: 26
Location: Oviedo, FL

PostPosted: Fri Jun 01, 2012 6:37 pm    Post subject: JCL
Reply with quote

only one IF in the jcl example... those are the 2 different IFs that i have tried and received the same error.
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Fri Jun 01, 2012 6:39 pm    Post subject:
Reply with quote

Could you show us the JESYSMSG from your SPOOL?

Thanks.
Back to top
View user's profile Send private message
jr3011

New User


Joined: 17 Apr 2008
Posts: 26
Location: Oviedo, FL

PostPosted: Fri Jun 01, 2012 6:43 pm    Post subject: JCL
Reply with quote

STMT NO. MESSAGE
2 IEFC001I PROCEDURE SORT WAS EXPANDED USING SYSTEM LIBRARY OD.PROD.PROC
10 IEFC001I PROCEDURE MAILREPT WAS EXPANDED USING SYSTEM LIBRARY OD.PROD.
9 IEF645I INVALID REFERBACK IN THE RC FIELD
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Jun 01, 2012 6:43 pm    Post subject:
Reply with quote

That should definitely be STEP1.Rc
Back to top
View user's profile Send private message
jr3011

New User


Joined: 17 Apr 2008
Posts: 26
Location: Oviedo, FL

PostPosted: Fri Jun 01, 2012 6:50 pm    Post subject: JCL
Reply with quote

I get the same error:

//JHSA29X JOB (1617,JRH,W811),'EDI REPORT',MSGCLASS=X,CLASS=A,USER=JRH
//STEP1 EXEC SORT
//SORTIN DD DSN=TEMP.JRH.MANUAL,DISP=(OLD,DELETE)
//SORTOF1 DD DSN=&&CHEPEML,DISP=(NEW,PASS)
//SYMNAMES DD DSN=CTLCDS.DUDA(SYMNAMES),DISP=SHR
//SYSIN DD DISP=SHR,DSN=CTLCDS.DUDA(ODSA29)
// IF STEP1.RC = 0 THEN
//MAILIT EXEC MAILREPT
//MFMAIL.REPORT DD DSN=&&CHEPEML,DISP=(OLD,DELETE)
//MFMAIL.SYSTSIN DD *
%XMITIP (JRH@DUDA.COM) NOMSG FILEDD REPORT -
SUBJECT 'CHEP PALLETS FOR REVERSAL' -
MSGT 'SEE ATTACHMENT FOR REPORT'
// ENDIF
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Fri Jun 01, 2012 7:00 pm    Post subject:
Reply with quote

Post the job output, especially the JES and SORT messages, using the CODE tag to preserve spacing. I suspect your problem is not what you think it is.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Jun 01, 2012 7:04 pm    Post subject:
Reply with quote

Pandora-Box wrote:
That should definitely be STEP1.Rc

No; SORT is the name of a procedure, thus the reference should be:
Code:
//         IF   (STEP1.procstepname.RC = 0) THEN
Back to top
View user's profile Send private message
jr3011

New User


Joined: 17 Apr 2008
Posts: 26
Location: Oviedo, FL

PostPosted: Fri Jun 01, 2012 7:06 pm    Post subject: Jcl
Reply with quote

Yes, that worked thanks.

// IF step1.sort.rc = 0 then
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Jun 01, 2012 7:09 pm    Post subject:
Reply with quote

Akatsukami wrote:
Pandora-Box wrote:
That should definitely be STEP1.Rc

No; SORT is the name of a procedure, thus the reference should be:
Code:
//         IF   (STEP1.procstepname.RC = 0) THEN




Arghhhhh

I never saw that my mistake

Thanks Akatsukami for bringing my tautology to an end
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Jun 01, 2012 8:29 pm    Post subject:
Reply with quote

jr3011,

It would have been easier if you had referred to this

Pay close attention to Relational-Expression Keywords

Thanks,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Help needed in Conditional statement ... vinu78 DB2 5 Tue Sep 15, 2015 10:14 am
No new posts Conditional OUTREC Deepakgoyal2005 SYNCSORT 3 Tue Nov 18, 2014 7:01 pm
No new posts DB2 Conditional Delete Vs Load Replace rockish DB2 6 Mon Sep 15, 2014 10:25 pm
No new posts Help with Conditional Select kaustuv ch DB2 2 Tue Aug 19, 2014 10:37 am
No new posts JOINKEY conditional formatting venkatprasana DFSORT/ICETOOL 2 Thu May 22, 2014 4:27 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us