IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare alphabetic variables in JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
migueysan

New User


Joined: 30 Jun 2008
Posts: 2
Location: Buenos Aires, Argentina

PostPosted: Wed Sep 10, 2008 5:50 pm
Reply with quote

Hi to all

I have the following problem

//IFPREG IF &TIPO EQ ORD THEN
// CLASE='A4_'
//IFPREG ENDIF

&TIPO is a parameter which may have the values OLD u ORD. Problem is:

a) If I don't use apostrophes, I got the following error:

55 //IFPREG IF &TIPO EQ ORD THEN
IEFC653I SUBSTITUTION JCL - OLD EQ ORD
56 // CLASE='A4_'
57 //IFPREG ENDIF
STMT NO. MESSAGE
55 IEFC013I ERROR IN IF STATEMENT: OLD NOT VALID
56 IEFC605I UNIDENTIFIED OPERATION FIELD

b) If I use apostrophes, I got this:

55 //IFPREG IF &TIPO EQ 'ORD' THEN
IEFC653I SUBSTITUTION JCL - OLD EQ 'ORD'
56 // CLASE='A4_'
57 //IFPREG ENDIF
STMT NO. MESSAGE
55 IEFC629I INCORRECT USE OF APOSTROPHE ON THE IF STATEMENT
55 IEFC629I INCORRECT USE OF APOSTROPHE ON THE IF STATEMENT
56 IEFC605I UNIDENTIFIED OPERATION FIELD

c) If I use double quotes, I got this:

55 //IFPREG IF &TIPO EQ "ORD" THEN
IEFC653I SUBSTITUTION JCL - OLD EQ "ORD"
56 // CLASE='A4_'
57 //IFPREG ENDIF
STMT NO. MESSAGE
55 IEFC620I UNIDENTIFIABLE CHARACTER " ON THE IF STATEMENT
55 IEFC620I UNIDENTIFIABLE CHARACTER " ON THE IF STATEMENT
56 IEFC605I UNIDENTIFIED OPERATION FIELD

Can anybody help? Thanks to all
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 10, 2008 11:54 pm
Reply with quote

Hello migueysan and welcome to the forums,

I'm not sure why, but your topic was locked and in the "Off Topics" part of the forum.

At the top of the page is a link to "IBM Manuals". Among them is the jcl reference.

Start here (from that link) and look around:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/iea2b650/17.1.4.5?

Basically, your code violates the "rules".
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Sep 11, 2008 12:20 am
Reply with quote

The manual states that only selected items are allowed in the JCL IF statement -- OLD (or &TIPO) is not one of them. Your IF statement cannot work as constructed, no matter WHAT you do to it.
Back to top
View user's profile Send private message
migueysan

New User


Joined: 30 Jun 2008
Posts: 2
Location: Buenos Aires, Argentina

PostPosted: Thu Sep 11, 2008 12:22 am
Reply with quote

So there is no way I can check the contents of an alphabetical variable? icon_question.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Sep 11, 2008 12:36 am
Reply with quote

Quote:
//[name] IF [(]relational-expression[)] THEN [comments]
.
. action when relational-expression is true
.
//[name] ELSE [comments]
.
. action when relational-expression is false
.
//[name] ENDIF [comments]
is the syntax according to the JCL LR manual.

and further in the manual is:
Quote:
17.1.4.5 Relational-Expression Keywords


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.

Keyword Use
RC
indicates a return code
ABEND
indicates an abend condition occurred
¬ABEND
indicates no abend condition occurred
ABENDCC
indicates a system or user completion code
RUN
indicates that the specified step started execution
¬RUN
indicates that the specified step did not start execution
As long as you use RC, ABEND, ABENDCC, RUN, ¬ABEND, ¬RUN you can do all the IF tests you want. I do not see "OLD" on this list, and IBM doesn't promise any support in that case.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Sep 11, 2008 2:38 am
Reply with quote

Hello,

If you post a more complete example of what you want to accomplish, someone may have a suggestion. Exlain the steps in the run and what needs to be tested. Do not focus on specific syntax until we all understand what we are trying to do.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Compare two files with a key and writ... SYNCSORT 3
No new posts Compare latest 2 rows of a table usin... DB2 1
Search our Forums:

Back to Top