DFSORT for Truncating a value



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

DFSORT for Truncating a value

Postby maheswaran37 » Wed Sep 15, 2010 8:24 pm

I have a file which has two type of records. I need to remove the 1st and the 8th character of the detail record of the first record type and write the rest of the records into the output file along with the modified records into the output file. The order in which the records apper should not change as it is very important. The file is of LRECL 35 and FB. The sample records are as follows.

0000000100907022011000 0 ----------> Header record of the first type of record (No change required)
01621041500295000020000 ----------> Detail record which requires the truncation (Change required)
03298701500200000030003 ----------> Detail record which requires the truncation (Change required)
999999900000000000000 ----------> Trailer record of the first type of record (No change required)
00 0100907022011000000000000000000 ----------> Header record of the second type of record (No change required)
T01 5000002000000000005900000000000 ----------> Detail record of the second type of record (No change required)
T04 5000008000003000135000000006000 ----------> Detail record of the second type of record (No change required)
Z99Z9000000000000000000000000000000 ---------->Trailer record of the second type of record (No change required)

Thanks you very much for your help.
maheswaran37
 
Posts: 10
Joined: Wed Sep 15, 2010 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT for Truncating a value

Postby Frank Yaeger » Wed Sep 15, 2010 10:31 pm

I need to remove the 1st and the 8th character of the detail record of the first record type


You haven't explained what you want to do clearly enough for anyone to help. You need to give the details of your "record types".

How do we identify the records that need to be truncated? Are they the records that have '01' or '03' in positions 1-2, or is there some other way to identify them (how - be specific)?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: DFSORT for Truncating a value

Postby maheswaran37 » Thu Sep 16, 2010 1:57 pm

Thanks for looking into it. The problem here is that there is no record type to identify the records. The records highlighted in RED are the ones to be truncated (1st and 8th character of each record) and the rest to be untouched and also the order should be preserved..
maheswaran37
 
Posts: 10
Joined: Wed Sep 15, 2010 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT for Truncating a value

Postby shyamsaravan » Thu Sep 16, 2010 3:43 pm

The problem here is that there is no record type to identify the records. The records highlighted in RED are the ones to be truncated (1st and 8th character of each record)


How to identify the RED highlighted records,,any specific key ?,and do clarify your file has only these 2 records in 2nd and 3rd row consecutively.

Give some necessive information

Thanks;
Saravan
shyamsaravan
 
Posts: 40
Joined: Tue May 11, 2010 7:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT for Truncating a value

Postby dick scherrer » Thu Sep 16, 2010 11:18 pm

Hello,

Sorry, but unless i missed a memo neither the sort nor any other utility has the ability pick records by color. . . :)

YOU need to post the rules and if there are no rules, this will be most difficult (if even possible) to write code to implement.

How did you know which 2 records to highlight?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: DFSORT for Truncating a value

Postby Frank Yaeger » Thu Sep 16, 2010 11:26 pm

Sorry, but unless i missed a memo neither the sort nor any other utility has the ability pick records by color. . .


ROTFL. Really good one, Dick. Maybe we should add INCLUDE by color, sound, smell, etc to DFSORT. :lol:

maheswaran37,

DFSORT is not psychic. If you can't explain the rules for selecting those records, then we can't tell DFSORT how to do it.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: DFSORT for Truncating a value

Postby maheswaran37 » Fri Sep 17, 2010 3:33 pm

I am really sorry for creating the confusion. I didnt mean to say that the records will be of red colour in my file. I highlighted the records with red colour to let you guys know that these are the records which require truncation. Let me make this clear

1)There are two type of records in the file. They are department level and item level. First comes the header, detail and the trailer of item level file followed by header, detail and trailer of department level file.
2) The item file header record has '0000000' as the first 7 characters
3) Next comes the detail record of the item level file (n number of records)
4) Only the 1st and the 8th digit of the item level detail record requires truncation.
5) The 9th character of the item level detail record has a constant value '5' (record type).
6) The item file trailer record has '9999999' as the first 7 characters
7) Next comes the department file header record with '_00_' as the first 4 characters ( _ specify spaces)
8) Next comes the department file detail records starting with 'T'
9) Finally, there will be department file trailer record having 'Z99Z9' as the first 5 characters

Note:
1) Only the item level detail records require truncation
2) The order in which the file appears should be preserved

Hope this helps.
maheswaran37
 
Posts: 10
Joined: Wed Sep 15, 2010 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT for Truncating a value

Postby Frank Yaeger » Fri Sep 17, 2010 9:00 pm

Here's a DFSORT job that will do what I think you want. I assumed that other records besides the detail records might have '5' in position 9, and what you really want is to truncate the records between but not including the 0s and 9s records.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/35)
//SORTOUT DD DSN=...  output file (FB/35)
//SYSIN DD *
  OPTION COPY
  INREC IFOUTLEN=35,
   IFTHEN=(WHEN=GROUP,BEGIN=(1,7,CH,EQ,C'0000000'),
    END=(1,7,CH,EQ,C'9999999'),PUSH=(36:ID=1)),
   IFTHEN=(WHEN=(36,1,CH,NE,C' ',AND,
      1,7,CH,NE,C'0000000',AND,1,7,CH,NE,C'9999999'),
    BUILD=(2,6,9,27))
/*
                 


For your input record example, the output records would be:

0000000100907022011000            0   
162104500295000020000                 
329870500200000030003                 
999999900000000000000                 
 00 0100907022011000000000000000000   
T01 5000002000000000005900000000000   
T04 5000008000003000135000000006000   
Z99Z9000000000000000000000000000000   


If that's NOT what you want, then explain how it differs from what you do want.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: DFSORT for Truncating a value

Postby maheswaran37 » Fri Sep 17, 2010 9:39 pm

Its working.Thank you very much. I designed the below given sort card but not satisfied as you rightly pointed out that the header and trailer might have '5' in the 9th position.

  OPTION COPY                                                       
  OUTREC IFTHEN=(WHEN=(1,7,CH,NE,C'9999999',AND,9,1,CH,EQ,C'5',AND,                           
                           35,1,CH,EQ,C' '),                           
                           BUILD=(1:2,6,7:9,27))
maheswaran37
 
Posts: 10
Joined: Wed Sep 15, 2010 8:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT for Truncating a value

Postby dick scherrer » Fri Sep 17, 2010 11:22 pm

Hello,

I am really sorry for creating the confusion. I didnt mean to say that the records will be of red colour in my file.
Not to worry :)

You didn't cause confusion. That was just a couple of us "old guys" having fun - i knew Frank would be one of the first to see the reply. It was not meant to be at your expense :oops:

Once upon a time, real cards were used for data and these cards were often of different colors or of different colored stripes. A different color for different types of data. When a big monthly run was complete, the cards were broken into their different types for storing until next month or the archives. When this large "rainbow" was separated, they were in fact sorted so that different colors (types) were separated and it looked like the machine was "color sorting" the cards.

Like i said - old guys. . . ;)
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post