How can i change the below code in SQL to cobol/400?

EXEC SQL
SELECT COUNT(*) INTO : WS-COUNT FROM Db file
WHERE Field 1 = : WS-VAR
AND Field 2 = : WS-USERID
END-EXEC
*
EVALUATE TRUE
WHEN SQLCODE = +000
MOVE WS-COUNT TO Copybook field
WHEN SQLCODE = +100
MOVE ZEROES TO Copybook field

Answers were Sorted based on User's Feedback



How can i change the below code in SQL to cobol/400? EXEC SQL SELECT COU..

Answer / mithun paul

1. Start the DB file with field1 and field2.
2. Read the DB file next record and increase the counter
value.
3. End the process, when end of file reached.
4. Move the counter value to Copybook field.



Mithun Paul
KMG Infotech Ltd., Kolkata

Is This Answer Correct ?    4 Yes 1 No

How can i change the below code in SQL to cobol/400? EXEC SQL SELECT COU..

Answer / mahendran

There can be 2 scenarios.

scenario #1

when field1 and field2 are keys on dbfile or keys of LF on
dbfiles

1. Start the DB file with field1 and field2.
2. Read the DB file next record and increase the counter
value.
3. End the process, when end of file reached.
4. if the counter value is greater than zero then move the
counter value to Copybook field else move zeros to the
copybook fields.

scenario #2

when field1 and field2 are not keys on dbfile or not part
of keys of any LF on dbfiles

1.Read the file
2.If the field1 = WS-VAR and Field2 = WS-USERID then
increase the counter
value.
3. End the process, when end of file reached.
4. if the counter value is greater than zero then move the
counter value to Copybook field else move zeros to the
copybook fields.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More COBOL400 Interview Questions

How can i change the below code in SQL to cobol/400? EXEC SQL SELECT COUNT(*) INTO : WS-COUNT FROM Db file WHERE Field 1 = : WS-VAR AND Field 2 = : WS-USERID END-EXEC * EVALUATE TRUE WHEN SQLCODE = +000 MOVE WS-COUNT TO Copybook field WHEN SQLCODE = +100 MOVE ZEROES TO Copybook field

2 Answers  


What is the syntax of redefine?

0 Answers  


It's possible use %TRIM statement like rpgile?

2 Answers  


what is the difference between section,paragraph and sentences

4 Answers  


define comp?

2 Answers  


Explain the difference between section, paragraph and sentences?

0 Answers  


Deleting a record from a Sequential file.

2 Answers   Polaris,


What is output procedure?

0 Answers  


can i anyone tell me how to use copybooks in cobol

1 Answers  


What is sort? And its syntax?

0 Answers  


What are fillers?

0 Answers  


How we can update data area in cobol 400 program?

12 Answers   Accenture,


Categories