IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sorting a record spanned over multiple line


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nutleytkd

New User


Joined: 05 Mar 2022
Posts: 5
Location: United States

PostPosted: Sat Mar 05, 2022 8:48 pm
Reply with quote

I would like to sort a FB file. The record has several segments. and LRECL is 310 bytes (Full data is not shown below.
===============================================
CA0 2857480 KINDRED KENDELYNN S 19691031M
CZ0 2857480 RLSHK00000000000000ZPN23073002130025930 MTP 111000333
DA0012857480 PF 87726
DA2012857480 8799 CHRISTIE WAY
EA0 2857480 NN
FA0012857480 2021091720210917230199285 0151200ABC
FA0022857480 2021091720210917230193010 0007500A
XA0 2857480 020201020000007 015
YA0351278228 MTP0001 351278228 000000200000110000001000158700
BA0421511291 MTP0002 421511291 E1386655272
BA1421511291 MTP0002 1377 11TH STREET NW
CA0 451676CLAIM MACLACHLAN DANISH 20170104F
CZ0 451676CLAIM RLSHK00000000000000ZPNE4835111310013149 MTP M111000333
..........................
..........................

Each segment is of 3 bytes and they are in column 1 for 3 bytes. For instance CA0, CZ0, XA0. The segment repeats. If you look in the data, starts at CA0 and Ends at BA1. I want to do a sort using CA0, and XA0 as keys
The fiellds that I need to copy and and create an output rec is lying on segments CA0 and XA0. Field interested from CA0 is in position 196 for 15 bytes and field from XA0 is at position 289 for a length of 10 bytes.
Is it possible to do using sort ? Can you provide me the sort JCL if feasible? or a program is really needed? Your response and time taken will be highly appreciated.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1489

PostPosted: Sat Mar 05, 2022 11:35 pm
Reply with quote

Use the Code button to make your samples clear to others

Also: try to explain your issue more clear; I personally do not understand your sentences about “segments”, “repeated parts”, etc.
What does it mean: “using CA0 and XA0 as keys”???

Provide clear examples.

If not, do not expect any answer.
Back to top
View user's profile Send private message
nutleytkd

New User


Joined: 05 Mar 2022
Posts: 5
Location: United States

PostPosted: Sun Mar 06, 2022 2:40 am
Reply with quote

sergeyken wrote:
Use the Code button to make your samples clear to others

Also: try to explain your issue more clear; I personally do not understand your sentences about “segments”, “repeated parts”, etc.
What does it mean: “using CA0 and XA0 as keys”???

Provide clear examples.

If not, do not expect any answer.


Please ignore the usage of segments. If you look at the records in sequence,
they have an order. It starts with CA0 3 bytes starting in column 1 for 3 bytes. Next CZ0. Then XA0. We need to pull fields from CA0 and XA0. Those field locations that I am interested are already mentioned early in the post. If I write a program I will read records sequentially checking the first 3 bytes. If the first three bytes equal 'CA0' then I will pull the field from that record and move to storage and if XA0, then also i will move the field values to storage and then write the record. Read will continue till all CA0 and XA0s are read.
Back to top
View user's profile Send private message
nutleytkd

New User


Joined: 05 Mar 2022
Posts: 5
Location: United States

PostPosted: Sun Mar 06, 2022 3:02 am
Reply with quote

when CA0 record and XA0 records are read and placed the interested field values in to storage, i will write the record. Then look for the next set of CA0 and XA0 records and once read and field values are moved to storage, write it out.
CA0 is the beginning and BA1 is the end. Then comes Ca0 and BA1 again.

Hope this makes more clarity. Whether you respond back or not, thanks for spending your time .
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1489

PostPosted: Sun Mar 06, 2022 8:53 pm
Reply with quote

Please, present a clear example of your input, and desired output.
You explanation is still extremely messy, and unclear.

Please, use the Code button for all your samples.
Back to top
View user's profile Send private message
nutleytkd

New User


Joined: 05 Mar 2022
Posts: 5
Location: United States

PostPosted: Mon Mar 07, 2022 4:49 am
Reply with quote

Is it possible to sort the file where the claim records are spread on more than one line? Field interested from CA0 is in position 196 for 15 bytes and field from XA0 is at position 289 for a length of 10 bytes.

Is it possible to sort the input file using 'CA0' and 'XA0' as record IDs and create an output file containing two fields starting at locations mentioned above using DFSORT?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1489

PostPosted: Mon Mar 07, 2022 5:24 am
Reply with quote

Please, present a clear example of your input, and desired output.
You explanation is still extremely messy, and unclear.

Please, use the Code button for all your samples.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1153
Location: Dublin, Ireland

PostPosted: Mon Mar 07, 2022 1:57 pm
Reply with quote

You can do this by GROUPing the records using BEGIN= and END= parameters.

On input to the sort, for each record in the group, PUSH the value you want from the CA0 record into position 311.

On output, include only the XA0 records and BUILD the output record from the 'pushed' field and the field(s) from the XA0 record.

Control cards (not JCL) like:
Code:
*                                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'CA0'),       
                END=(1,3,CH,EQ,C'BA1'),                   
    PUSH=(311:196,15))                                     
*                                                         
  OUTREC INCLUDE=(1,3,CH,EQ,C'XA0'),                       
          BUILD=(1:311,15,289,10)                         
*                                                         
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1489

PostPosted: Mon Mar 07, 2022 7:47 pm
Reply with quote

nutleytkd wrote:
Is it possible to sort the input file using 'CA0' and 'XA0' as record IDs

What does this mean? icon_question.gif

Any SORT can be done on a record field (or column), but not on a particular record field value
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1153
Location: Dublin, Ireland

PostPosted: Mon Mar 07, 2022 8:01 pm
Reply with quote

I would think that the TS wants to use the values 'CA0', 'XA0' and 'BA1' in a record field to identify those particular records.

And I believe DFSORT sorts record field(s) on the value in the field(s)....

Garry.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1489

PostPosted: Mon Mar 07, 2022 8:24 pm
Reply with quote

Garry Carroll wrote:
And I believe DFSORT sorts record field(s) on the value in the field(s)....

Yes, exactly: on (the value in) the field of every record, but NOT on particular values in some fields of some records...
Back to top
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 771
Location: Bamberg, Germany

PostPosted: Wed Mar 09, 2022 6:17 pm
Reply with quote

It seems like flogging a dead horse here. The topic should be closed.
Back to top
View user's profile Send private message
nutleytkd

New User


Joined: 05 Mar 2022
Posts: 5
Location: United States

PostPosted: Sun Mar 13, 2022 2:34 am
Reply with quote

Thanks a lot Garry Carroll for your assistance here. I was able to achieve the desired output.

The job was abending saying BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY

The only thing I updated from your control card is OUTFIL INCLUDE instead of OUTREC INCLUDE=

Below is the output i got.
117220382475300DE92888986
137220400007700DE92888987
137220400017700DE92888988
804220390172700DE92888989
960220450001300DE93897818
960220450001400DE93897819
960220450007300DE93897820
137220450008800DE95902533
137220450027200DE95902534
137220450028000DE95902535
117220421127300DE95902536
137220420100200DE95902537
137220420102600DE95902538
836220390071200DE95902539
219220411063900DE95902540
...........................................
...........................................
...........................................
I can format it and add more fields if I want
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1489

PostPosted: Sun Mar 13, 2022 5:02 am
Reply with quote

nutleytkd wrote:

I can format it and add more fields if I want

Please, use the Code button to make your samples clear to others
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts IKJACCNT and WRNG.LEN.RECORD ABENDS & Debugging 5
No new posts Splitting group records based on deta... DFSORT/ICETOOL 8
No new posts ICE218A 6 12 BYTE VARIABLE RECORD IS ... DFSORT/ICETOOL 14
No new posts ICETOOL with JOINKEY for Big record l... DFSORT/ICETOOL 12
No new posts Finding record and replacing with val... DFSORT/ICETOOL 3
Search our Forums:

Back to Top