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

Answers were Sorted based on User's Feedback



How can i change the below code in SQL to cobol/400? EXEC SQL SELECT COUNT(*) INTO : WS-COUNT FROM ..

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.




Mithun Paul
KMG Infotech Ltd., Kolkata

Is This Answer Correct ?    5 Yes 0 No

How can i change the below code in SQL to cobol/400? EXEC SQL SELECT COUNT(*) INTO : WS-COUNT FROM ..

Answer / srinivas

Declare below three variables in working storage section.

77 WS-COUNT PIC 99. VALUE ZEROS.
77 WS-VAR PIC X(10) VALUE "WELCOME".
77 WS-USERID PIC x(5) VALUE "AAAAA".
Decalre one indicator for end of file.
04 EOF-DB-FILE PIC X VALUE "N".
88 EOF-DB-FILE VALUE "Y".
Read each record from input file(Db file) and increase
count if the conditions are satisfied.
PROCEDURE DIVISION.
OPEN INPUT DB-FILE.
READ Db-file
AT END MOVE "Y" TO EOF-DB-FILE
GO TO 1000-EXIT.
IF FIELD1 = WS-VAR AND FIELD2 = WS-USERID
ADD 1 TO WS-COUNT
END-IF
GO TO 1000-EXIT.
DISPLAY WS-COUNT
CLOSE DB-FILE.
STOP RUN.

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More COBOL400 Interview Questions

What is comp?

0 Answers  


what is the difference between section,paragraph and sentences

4 Answers  


Explain what all the conditiones required for using open opcode on a file?

0 Answers  


What is perform?

0 Answers  


How we can update data area in cobol 400 program?

12 Answers   Accenture,






How to detect record is locked in cobol/400? What is the solution for that?

0 Answers  


What is sort?

0 Answers  


Trying to help a friend... How do you code screen I/O without a DDS? I know it can be done, because for a short time, I worked for a company that did it. It was just too long ago for me to remember what was involved.

1 Answers  


How to detect record is locked in cobol/400?

0 Answers  


Explain the output procedure?

0 Answers  


define sort? and its syntax?

3 Answers  


What is output procedure?

0 Answers  


Categories