Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6970
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
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us