Concatinating two rec by using COBOL & JCL

I need to concatenate records by using cobol and jcl (both) as follows.
Input File:
AAAAA
BBBBB
CCCCC
DDDDD
11111
22222
33333
44444
Split the file into two halves and
1st rec of first half and 2nd rec of second half records are concatinated and
2nd rec of first half and 2nd rec of second half records are concatinated and so on.....
and o/p as given below
Output File:
AAAAA 11111
BBBBB 22222
CCCCC 33333
DDDDD 44444

Questions by mannurusrinivasulareddy   answers by mannurusrinivasulareddy

Showing Answers 1 - 15 of 15 Answers

Rajesh.chedhalla

  • Sep 26th, 2012
 

1. Split the INPUT File into two halves and generate the SEQNUM for each record.
2. Then Join the two files on SEQNUM and Reformat the fields in required format.

  Was this answer useful?  Yes

sarav

  • Dec 21st, 2016
 

@Rajsh.chedhalla
Could you please provide me some example to understand it well.
Thanks in advance

  Was this answer useful?  Yes

Nitika Malhotra

  • Sep 14th, 2017
 

Read the File containing the records and validate as below.
SET NOT-EOF-FILE TO TRUE
READ WS-FILE
AT END SET EOF-FILE TO TRUE
END-READ
PERFORM UNTIL EOF-FILE
IF WS-REC IS NUMERIC
LOAD TABLE-NUMERIC (IDX1)
INCREMENT CTR1
ELSE
LOAD TABLE-ALPHABET (IDX2)
INCREMENT CTR2
END-IF
READ WS-FILE
AT END SET EOF-FILE TO TRUE
END-READ
END-PERFORM
SET IDX1 AND IDX2 TO 1
PERFORM UNTIL IDX1 > CTR1 AND IDX2 >CTR2
STRING WS-REC1(IDX1) DELIMITED BY SIZE
WS-REC2(IDX2) DELIMITED BY SIZE
INTO WS-REC-NEW-FILE
WRITE FILE2
SET BOTH IDX1 AND IDX2 UP BY 1
END-PERFORM

  Was this answer useful?  Yes

Kalyan

  • Mar 20th, 2018
 

Outrec overlay=(5:13,3,9:5,3,13:17,3,17:9,3)

  Was this answer useful?  Yes

GAURAVARAM

  • Dec 5th, 2018
 

Please post your requirement clearly ..
If you have to concatenate the records from two different files you can use IEBGENER

Code
  1.  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions