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

Condition Name with Set


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
RamsIBM

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Sat Jul 19, 2008 11:15 pm
Reply with quote

Hi All,

In my program i have variable decalariton like this

05 SW-XXXX-INDICATOR PIC X.
88 SW-XXXX VALUE 'Y'.
88 SW-XXXX-NO VALUE 'N'.


Can you please check is these below statments is right.
if I give in any para in procdeure divionsion

Set sw-XXXX to 'Y'
or
set SW-XXX to 'N'
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sat Jul 19, 2008 11:28 pm
Reply with quote

Instead of -

Code:

Set sw-XXXX to 'Y'
or
set SW-XXX to 'N'

change it to -

Code:

Set sw-XXXX to TRUE
or
set SW-XXX to TRUE

and all will be forgiven icon_wink.gif

Regards,

Bill
Back to top
View user's profile Send private message
RamsIBM

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Sat Jul 19, 2008 11:42 pm
Reply with quote

Hi Bill Thanks for your reply....

But My requirement is they want to set Y or N flag

Shall I give like this

Set sw-XXXX to 'Y'
or
set SW-XXX-No to 'N'
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sun Jul 20, 2008 12:02 am
Reply with quote

In my previous posting, the "Set sw-XXXX to TRUE" was the correct syntax (this will move a 'Y' to the SW-XXXX-INDICATOR) whereas, "Set sw-XXXX-NO to TRUE" will move an 'N' to the SW-XXXX-INDICATOR.

The ability to set 88 levels to TRUE will work, unless you're on OS/VS COBOL, which is very old.

If this is the case, then you'd have to MOVE either a 'Y' or an 'N' to SW-XXXX-INDICATOR.

The TRUE condition for 88 levels was first introduced with COBOL2 (mid/late 1980's).

Bill
Back to top
View user's profile Send private message
RamsIBM

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Sun Jul 20, 2008 12:23 am
Reply with quote

I understood you explanation.

But still my doubt is

Shall we give like

Set sw-XXXX to 'Y'
or
set SW-XXX to 'N'

Is it possible to assign some values(i.e 'Y' or 'N') to condition name using SET keyword or we can assign only TRUE or FALSE value through SET statment
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sun Jul 20, 2008 1:21 am
Reply with quote

Perhaps another member will jump in with an explanation, because I've run out of ways to explain this.... icon_confused.gif

Bill
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sun Jul 20, 2008 2:16 am
Reply with quote

You can move 'Y' or 'N' (or any alphanumeric value) to SW-XXXX-INDICATOR or you can SET SW-XXXX TO TRUE or SET SW-XXX-NO TO TRUE but you can not use SET with SW-XXXX-INDICATOR and for SW-XXXX and SW-XXX-NO you can only SET these to TRUE (which is the same as moving 'Y' or 'N' to SW-XXXX-INDICATOR). If SW-XXXX-INDICATOR is anything other then 'Y' or 'N" then both condition names will be false. I think that for readability you should either use the SET and the condition name tests or use the the move and equality test but don't mix them together.
Back to top
View user's profile Send private message
RamsIBM

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Sun Jul 20, 2008 2:27 am
Reply with quote

Since I got the access I tried in my system and I understood Thanks
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to give complex condition in JCL . CLIST & REXX 30
No new posts selectively copy based on condition DFSORT/ICETOOL 3
This topic is locked: you cannot edit posts or make replies. Control-m JOB executing even when the... Compuware & Other Tools 6
No new posts Dynamic condition checks COBOL Programming 5
No new posts Extract 2 more lines below line that ... DFSORT/ICETOOL 2
Search our Forums:

Back to Top