View previous topic :: View next topic
|
Author |
Message |
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
Hi,
I want to execute one particular step depending on a field value. I have gone through the existing jobs in my prod lbrary and google. It seems we can validate the return code of a particular step through IF condition.
I want to execute a step if field1 not equal to spaces
Can anyone tell me if it is at all possible to check a field value in JCL. And if possible what will be the yntax for this.
I was using
Code: |
// IF EMAIL1='' THEN |
but it is not working |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Priyanka Pyne wrote: |
Hi,
I want to execute one particular step depending on a field value. I have gone through the existing jobs in my prod lbrary and google. It seems we can validate the return code of a particular step through IF condition.
I want to execute a step if field1 not equal to spaces
Can anyone tell me if it is at all possible to check a field value in JCL. And if possible what will be the yntax for this.
I was using
Code: |
// IF EMAIL1='' THEN |
but it is not working |
As reading the fine manual would have told you, this is not even close to acceptable.
Now, what is the source of FIELD1 supposed to be? A symbolic variable? A parameter taken from a data set, or output by a program? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Priyanka Pyne wrote: |
Hi,
I want to execute one particular step depending on a field value. I have gone through the existing jobs in my prod lbrary and google. It seems we can validate the return code of a particular step through IF condition.
I want to execute a step if field1 not equal to spaces
Can anyone tell me if it is at all possible to check a field value in JCL. And if possible what will be the yntax for this.
I was using
Code: |
// IF EMAIL1='' THEN |
but it is not working |
What does the JCL manual say about the IF statement
Look at the top of this page under IBM MANUALS! |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
I am paasing the value of field1 through panel. It will be a emanil id. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
please reply to the following question ( already asked anyway )
What does the JCL manual say about the IF statement ??? |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
I looked into the manuals. JCL user guide and JCL language references. What I found there is, expressin can be used in the IF clause. But I am not sure if anything can be use as expression other than RC. Please correct me if I am wrong. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Priyanka Pyne wrote: |
I am paasing the value of field1 through panel. It will be a emanil id. |
For the sake of discussion, I assume that a Rexx exec is being used to handle the panel and tailor skeletonized JCL. Add the first two steps at the beginning of your job:
Code: |
//STEP000A EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *,DLM=@@
/* Rexx */
trace o
if (&FIELD1=' ') then return 666
else return 0
@@
//SYSUT2 DD DSN=&&TEMP(FOO),DISP=(NEW,PASS),SPACE=(TRK,(1,1,1)),
// UNIT=TEMPDISK,DCB=(RECFM=VB,LRECL=255)
//SYSIN DD DUMMY
//STEP000B EXEC PGM=IRXJCL,PARM='FOO'
//SYSEXEC DD DSN=&&TEMP,DISP=(OLD,DELETE)
//SYSTSPRT DD SYSOUT=* |
Encapsulate the desired JCL thus:
Code: |
//IF1 IF (STEP000B.RC = 666) THEN
(stuff to be done)
//ENDIF1 ENDIF |
|
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Priyanka Pyne wrote: |
I looked into the manuals. JCL user guide and JCL language references. What I found there is, expressin can be used in the IF clause. But I am not sure if anything can be use as expression other than RC. Please correct me if I am wrong. |
Your reading comprehension seems flawed. z/OS V1R12.0 MVS JCL Reference clearly states:
Quote: |
The following keywords are the only keywords supported by IBM and recommended for use in relational-expressions. Any other keywords, even if accepted by the system, are not intended or supported keywords. |
(Emphasis added.) |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
Hi Akatsukami
Could you please let me know which file you are refereing here by DSN=&&TEMP? |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
I tried the provide code but it I am getting RC=3651. I am not sure if I am missing something. Here is what I am doing.
Code: |
//STEP000A EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *,DLM=@@
/* Rexx */
trace o
if (=' ') then return 666
else return 0
@@
//SYSUT2 DD DSN=&TEMP(FOO),DISP=(NEW,PASS),SPACE=(TRK,(1,1,1)),
// UNIT=SYSDA,DCB=(RECFM=VB,LRECL=255)
//SYSIN DD DUMMY
//****************************************************************
//STEP000B EXEC PGM=IRXJCL,PARM='FOO'
//SYSEXEC DD DSN=&TEMP,DISP=(OLD,DELETE)
//SYSTSPRT DD SYSOUT=*
//****************************************************************
//IF1 IF (STEP000B.RC = 666) THEN
//SEND EXEC PGM=IKJEFT1B
//SYSIN DD DUMMY
//SYSEXEC DD DSN=TSO.SSS.REXXLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
%XMITIP () -
MSGDD CONTENT -
MSG72 -
REPLYTO xxx@dddd.com -
FROM xxx@dddd.com -
SUBJECT 'Compare job execution status'
/*
//CONTENT DD *
Comparison job has been completed and the output datasets are ready.
/*
//ENDIF1 ENDIF |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I tried the provide code but it I am getting RC=3651. |
In which step. . .?
Post the diagnostic information generated by the problem step.
If you want people to help, you simply must post something to work with . . . |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Priyanka Pyne wrote: |
I am paasing the value of field1 through panel. It will be a emanil id. |
I hope you are using a skeleton JCL.
And if yes, why not just do:
Code: |
)SEL &EMAIL ¬= &Z
.
. place your step here
.
)ENDSEL |
No value = no step. Nothing easier than that! |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
If you are passing the value through a panel then surely your logic which displays the panel and accepts values should also include the logic to either submit the job or not rather than faffing about doing something totally unrequired in a batch job. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Priyanka Pyne wrote: |
I tried the provide code but it I am getting RC=3651. |
FIELD1 is set to null, not space, on return from the panel, as your output clearly shows.
On consideration,I like Marso's solution better than the one I originally devised; it's more comprehensible. |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
Hi Marco,
I am getting this error.
Code: |
ISPF107
Control word error
Invalid control word parameter, EMAIL record-24
PYNPRIY,JHLOGPRC,11/08/29,11:05,1,ISR,PGM(ISRUDL) PARM(ISRUDLP) SCRNAME(D
File tailoring input line:
)SEL &EMAIL1.¬= &Z
Enter HELP command for further information regarding this error.
Press ENTER key to terminate the dialog. |
|
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
Try losing the dot after &EMAIL1 |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
Tried that..same error
Code: |
ISPF107
Control word error
Invalid control word parameter, EMAIL record-24
PYNPRIY,JHLOGPRC,11/08/29,13:19,2,ISR,PGM(ISRUDL) PARM(ISRUDLP) SCRNAME(D
File tailoring input line:
)SEL &EMAIL1¬= &Z
Enter HELP command for further information regarding this error.
Press ENTER key to terminate the dialog.
|
|
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
There needs to be a SPACE between the variable name and the operator. |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
Great!!!. Working now. I have one concern. My job has only this step and if the condition is getting satisfied i.e. email id is blank the job is getting JCL error. Is there anything which can be done? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
We don't, yet, have access to your latest JCL. If you can post it and tell us the details of the error you are getting, maybe there is something that can be done. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Add a step to your skeleton JCL that executes IEFBR14 - I suspect, but do not know as you have not told us, that the JCL error is something along the lines of 'JOB HAS NO STEPS'.
Time to put your thinking cap on and think about the error and how to resolve it. |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
Thanks a lot to everyone. This is working fine now. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
This is working fine now. |
So, what was the problem and what fixed it?
If you expect people to spend so much time on your several issues, the least you could do is post what the problem actually was and what fixed it.
You may find less people willing to help if you continue to have these drag-on topics and then provide no followup. . .
d |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
I updated it here as soon as i fixed it. It was giving NO STEP FOUND ERROR. I did as suggested and that worked. I should have given more detail in my earlier post itself. I am really sorry for that. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Priyanka Pyne wrote: |
Great!!!. Working now. I have one concern. My job has only this step and if the condition is getting satisfied i.e. email id is blank the job is getting JCL error. Is there anything which can be done? |
In that case, consider:
Code: |
IF EMAIL <> '' THEN DO
"FTOPEN ..."
"FTINCL ..."
"FTCLOSE"
"SUBMIT ..."
END |
|
|
Back to top |
|
|
|