poongs Warnings : 1 New User
Joined: 24 Jan 2007 Posts: 28 Location: pune
|
|
|
|
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. |
|