Hi,
I have a file (FB LRECL=20) that contains following four records:
File
20230417ABCD20230420
20230418ABCD20230421
20230419ABCD20230424
20230420ABCD20230425
What I want to accomplish is:
-Take first eight position from record 1 and combine it with character ',' and eight last position from record 2.
-Take first eight position from record 2 and combine it with character ',' and eight last position from record 3.
-Take first eight position from record 3 and combine it with character ',' and eight last position from record 4.
-Take first eight position from record 4 and combine it with character ',' and eight last position from record 5 (but there are only four records so put eight spaces instead).
The output should be a file (FB LRECL=17) containing:
20230417,20230421
20230418,20230424
20230419,20230425
20230420,
Thanks in advance,
Mikael
Join parts of two records from same file
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: Join parts of two records from same file
Based on your post, one can think that you are the manager who assigns some tasks to the forum members?
I suspect this task has been assigned to yourself by your manager, but you decided to do nothing but hire free slaves from the forum, isn’t it?
I suspect this task has been assigned to yourself by your manager, but you decided to do nothing but hire free slaves from the forum, isn’t it?
Javas and Pythons come and go, but JCL and SORT stay forever.
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: Join parts of two records from same file
Hint:
- Create two copies of input, with line sequence numbers starting from 1 in one copy, and starting from 2 in another one,
- Join two copies by their sequence numbers,
- Combine the required fields from joined records.
That’s it.
Try TO DO SOMETHING YOURSELF, before assigning your task to others.
This is the rule for this forum.
- Create two copies of input, with line sequence numbers starting from 1 in one copy, and starting from 2 in another one,
- Join two copies by their sequence numbers,
- Combine the required fields from joined records.
That’s it.
Try TO DO SOMETHING YOURSELF, before assigning your task to others.
This is the rule for this forum.
Javas and Pythons come and go, but JCL and SORT stay forever.
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: Join parts of two records from same file
What have you tried so far??!!
Javas and Pythons come and go, but JCL and SORT stay forever.
-
- Similar Topics
- Replies
- Views
- Last post
-
-
File def'n-problem with different records layouts
by ralph » Tue Oct 26, 2021 10:47 pm » in IBM Cobol - 2
- 1505
-
by ralph
View the latest post
Wed Oct 27, 2021 1:42 am
-
-
- 3
- 6698
-
by sergeyken
View the latest post
Sun May 01, 2022 11:26 pm
-
-
Split file, SORT then append records.
by Esmayeelhusen » Fri Aug 04, 2023 6:37 pm » in DFSORT/ICETOOL/ICEGENER - 10
- 4976
-
by Esmayeelhusen
View the latest post
Wed Aug 09, 2023 7:39 am
-
-
-
Process file/records until a specific total is reached.
by chillmo » Thu Mar 24, 2022 6:18 am » in Syncsort/Synctool - 12
- 3712
-
by sergeyken
View the latest post
Wed Mar 30, 2022 10:12 pm
-
-
-
Create multiple records based on one record within a file.
by chillmo » Thu Aug 11, 2022 3:54 am » in Syncsort/Synctool - 5
- 7672
-
by sergeyken
View the latest post
Fri Aug 12, 2022 2:23 am
-