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
 

 

How to set the FLAGS in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
poongs
Warnings : 1

New User


Joined: 24 Jan 2007
Posts: 28
Location: pune

PostPosted: Fri Aug 03, 2007 4:09 pm    Post subject: How to set the FLAGS in COBOL
Reply with quote

Hi ppl,

Jus wanted a more clear picture of the FLAG concept in COBOL.
My Program sets a CUSTOMER_FOUND flag if Sqlcode on a table A is '0' and if this flag is set it goto insert an entry in another table B.For every record read from from the file the pgm checks for a particular ID(which is from 11 chars starting from 14h position in the input file) and if the previous record ID and the next records ID does not match it gotto query table A(and checks for SQLCODE '0' or '100').Here when sqlcode 100 results ,it gotto set a flag CUSTOMER_NOT_FOUND and should not insert into table B.
how to set the FLAGS?
now what i have tried to do is

03 WF-UNKNOWN-CUSTOMER PIC X
VALUE 'N'.
88 UNKNOWN-CUSTOMER-FOUND VALUE 'Y'.
88 UNKNOWN-CUSTOMER-NOT-FOUND VALUE 'N'.
03 WF-KNOWN-CUSTOMER PIC X
VALUE 'N'.
88 KNOWN-CUSTOMER-FOUND VALUE 'Y'.
88 KNOWN-CUSTOMER-NOT-FOUND VALUE 'N'.

---------------------------------------------------------------

for querying table A,

IF SQLCODE = 0
SET KNOWN-CUSTOMER-FOUND TO TRUE
SET UNKNOWN-CUSTOMER-NOT-FOUND TO TRUE
ELSE
IF SQLCODE = 100
SET UNKNOWN-CUSTOMER-FOUND TO TRUE
SET KNOWN-CUSTOMER-NOT-FOUND TO TRUE

But the pgm is not switching the Flags.Like whatever flag i have set for the first queryign is retained for all the results.

Can anyone pls give me a clear picture of the FLAG concept.

Thnx in Advance.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 03, 2007 5:20 pm    Post subject:
Reply with quote

you have too many flags. why not
Code:

...
select from table a
...
IF SQLCODE = 100
THEN
    PERFORM INSERT-TABLE-B
END-IF
...
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Submit job from Cobol with input data abdulrafi COBOL Programming 4 Wed Feb 01, 2017 12:41 pm
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am


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