Cobol - I want to copy only even number records out of 50 i

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
chennadi
Member
Posts: 1
Joined: Sat Jun 21, 2014 12:58 pm

Cobol - I want to copy only even number records out of 50 i

Post by chennadi » Sat Jun 21, 2014 1:13 pm

Hi,

I want to copy only even number records out of 50 in PS file. In this based on emp no it should be copy (empno records are like 1,2 .... 100).

Please provide me the correct solution.
Last edited by chennadi on Sun Jun 22, 2014 9:04 pm, edited 1 time in total.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Sat Jun 21, 2014 3:56 pm

Have a "flag". Intial value is set off. Test the flag when each record is procesed: if off, set it on for the processng of the next record; if on, write the record, set it off for the processing of the next record.

dhiraj
Member
Posts: 48
Joined: Tue May 06, 2014 11:22 am

Post by dhiraj » Wed Jun 25, 2014 3:27 pm

Try it..

8000-Read-In-File
8000-exit.

1000-Perform-copy
1000-exit until End-of-file.

1000-Perform-Copy

8000-Read-In-File
8000-exit.

9000-write-out-file
9000-write-exit.

8000-Read-In-File
8000-exit.

1000-exit.
Thanks,
--Dhiraj Mishra

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others