Join parts of two records from same file



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Join parts of two records from same file

Postby Mickes » Thu Apr 27, 2023 3:47 am

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
Mickes
 
Posts: 4
Joined: Sat Nov 23, 2019 12:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: Join parts of two records from same file

Postby sergeyken » Thu Apr 27, 2023 12:23 pm

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?
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: Join parts of two records from same file

Postby sergeyken » Thu Apr 27, 2023 12:53 pm

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.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

Re: Join parts of two records from same file

Postby sergeyken » Sat Apr 29, 2023 1:32 pm

What have you tried so far??!!
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post