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

How to set the FLAGS in COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top