Parsing the data using Sort,



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

Parsing the data using Sort,

Postby rjambu » Tue Feb 08, 2011 9:05 pm

Hi can anyone help me in the parsing the data using Sort, below is the detail.

//STEP010 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD  DSN=abcd.src.111,DISP=SHR       
//SORTOUT  DD  DSN=abcd.Dest.111,             
//             UNIT=DISK,SPACE=(TRK,(1,2),RLSE), 
//             DISP=(,CATLG,DELETE)                                                       
//SYSIN    DD  *                                 
  SORT FIELDS=COPY                                 
  INREC PARSE=(%00=(ENDBEFR=X'6A',FIXLEN=12),     
              %01=(ENDBEFR=X'6A',FIXLEN=08),
              %02=(EXDBEFR=X'6A',FIXLEN=09),
              %03=(EXDBEFR=X'6A',FIXLEN=01),
  BUILD=(%00,%01,%02,%03)
/* 


999999999¦¦31320000.00¦Y
111111123¦CETESTXY¦1664.00¦Y
111111234¦¦650104000.00¦Y
111111345¦¦0.00¦Y

o/p:
----+----1----+----2----+----3----+----4----+----5--
999999999 31320000.Y
111111123 CETESTXY731664.00Y
111111234 650104000Y
111111345 0.00 Y

Required O/p:
4th Column needs to be converted to 9 char lentgh,
the source value for this column will be 105000.00, 0.00, 75000.00,... i need to convert these values to 9 char field to a file.The values for this column should be parsed from Right to left 9 char, like the one below

----+----1----+----2----+----3----+----4----+----5--
999999999 320000.00Y
111111123 CETESTXY731664.00Y
111111234 104000.00Y
111111345 0.00Y

Can any one help in this issue.
rjambu
 
Posts: 27
Joined: Tue Feb 08, 2011 7:59 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Parsing

Postby Frank Yaeger » Wed Feb 09, 2011 12:33 am

4th Column needs to be converted to 9 char lentgh,
the source value for this column will be 105000.00, 0.00, 75000.00,... i need to convert these values to 9 char field to a file.The values for this column should be parsed from Right to left 9 char, like the one below


Huh? Where is 105000.00 in the input file? Where is 75000.00 in the input file? I see a Y in the 4th column for your input records. I see values like 31320000. and 1664.00 in the 3rd column for your input records. I don't understand the rules you want to use for getting from input to output. I don't understand what your input numbers can look like (2 decimal places, no decimal places, what?) or how you want them converted to output numbers.

You need to do a better job of explaining what you want to do with a better example and corresponding rules. Also, what is the RECFM and LRECL of the input file?
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: Parsing

Postby rjambu » Fri Feb 11, 2011 12:02 am

Here is the corrected i/o data :
JCL code tahat does this transformation :
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=abcd.src.111,DISP=SHR
//SORTOUT DD DSN=abcd.Dest.111,
// UNIT=DISK,SPACE=(TRK,(1,2),RLSE),
// DCB=(LRECL=40,BLKSIZE=0,RECFM=FB),
// DISP=(,CATLG,DELETE)
//SYSIN DD *
SORT FIELDS=COPY
INREC PARSE=(%00=(ENDBEFR=X'6A',FIXLEN=12),
%01=(ENDBEFR=X'6A',FIXLEN=08),
%02=(EXDBEFR=X'6A',FIXLEN=09),
%03=(EXDBEFR=X'6A',FIXLEN=01),
BUILD=(%00,%01,%02,%03)
/*
I/p:

999999999¦¦31320000.00¦Y
111111234¦¦650104000.00¦Y
111111255¦¦120000.00¦Y
111111123¦CETESTXY¦1664.00¦Y
111111345¦¦0.00¦Y


The above file comes from an External Source system
col1: EMpid
col2: position id (can be empty)
col3: amount
col4: indicator ( can be Y or N)

The output comes pretty much good as expected except for the 3rd column Amount. for very few rows this columns comes more than 9 value including the decimal and because of this the O/P for that col is truncates the last 2 digits after decimal point sometime 3 digits.
Example: for column 3

SRC CURR O/P REQ O/P
------------ ---------- --------
31320000.00 31320000. 320000.00
650104000.00 650104000 104000.00
120000.00 120000.00 120000.00
1664.00 1664.00 1664.00
0.00 0.00 0.00

Current and the required o/p is below:
CURRENT O/P
------------
999999999 31320000.Y
111111234 650104000Y
111111255 120000.00Y
111111123 CETESTXY1664.00 Y
111111345 0.00Y

REQUIRED O/P
------------
999999999 320000.00Y
111111234 104000.00Y
111111255 120000.00Y
111111123 CETESTXY 1664.00Y
111111345 0.00Y

please let me know if this is possible?
rjambu
 
Posts: 27
Joined: Tue Feb 08, 2011 7:59 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Parsing

Postby Frank Yaeger » Fri Feb 11, 2011 4:20 am

You can use the following DFSORT control statements to get what you want:

  SORT FIELDS=COPY
  INREC PARSE=(%00=(ENDBEFR=X'6A',FIXLEN=12),
              %01=(ENDBEFR=X'6A',FIXLEN=08),
              %02=(ENDBEFR=X'6A',FIXLEN=15),
              %03=(ENDBEFR=X'6A',FIXLEN=01)),
  BUILD=(%00,%01,%02,UFF,EDIT=(IIIIIT.TT),%03)
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: Parsing

Postby rjambu » Sat Feb 12, 2011 12:31 am

Hi Frank,
I used the above control statement the o/p is fine but with some error when i tested with different data.
For Example:

i/p o/p
31320000.00 313200.00
650104000.00 650104.00
650104123.56 501041.23 instead i need o/p like 104123.56
120000.00 120000.00

Thanks
JRS
rjambu
 
Posts: 27
Joined: Tue Feb 08, 2011 7:59 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Parsing

Postby Frank Yaeger » Sat Feb 12, 2011 12:44 am

I have no idea what you want. I gave you a job based on the input and expected output you showed in your first post.

Now you seem to have a completely different output requirement, but no explanation of the rules for getting from input to output. I can't tell if the new output values are what you got or what you want. I don't even see a pattern in your new data.

Please start over. Show an example of the records in your input file (relevant fields only) and what you expect for output for all relevant cases. Explain the "rules" for getting from input to output.
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: Parsing the data using Sort,

Postby rjambu » Mon Feb 14, 2011 10:28 pm

Hi Frank,
below is the i/p and the required o/p

Eg:
I/p Required o/p

123456789.12 456789.12
123456.12 123456.12
12345.12 12345.12

But the o/p i get for the First row is 234567.89 instead of 456789.12

Thanks
JRS
rjambu
 
Posts: 27
Joined: Tue Feb 08, 2011 7:59 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Parsing the data using Sort,

Postby Frank Yaeger » Mon Feb 14, 2011 11:59 pm

Did you use my second set of control statements? When I use them with your input data, I get your expected output data.

For example, with:

//STEP010 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD  *
999999999¦¦123456789.12¦Y
111111345¦¦123456.12¦Y
111111345¦¦1234.12¦Y
//SORTOUT  DD  SYSOUT=*
//SYSIN    DD  *
  SORT FIELDS=COPY
  INREC PARSE=(%00=(ENDBEFR=X'6A',FIXLEN=12),
              %01=(ENDBEFR=X'6A',FIXLEN=08),
              %02=(ENDBEFR=X'6A',FIXLEN=15),
              %03=(ENDBEFR=X'6A',FIXLEN=01)),
  BUILD=(%00,%01,%02,UFF,EDIT=(IIIIIT.TT),%03)
/*


SORTOUT has:

999999999           456789.12Y 
111111345           123456.12Y 
111111345             1234.12Y 


I suspect you did not increase FIXLEN for %02 from 9 to 15 as I did.
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: Parsing the data using Sort,

Postby rjambu » Tue Feb 15, 2011 8:54 pm

Thanks Frank,
Works as expected

Thanks,
JRS
rjambu
 
Posts: 27
Joined: Tue Feb 08, 2011 7:59 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post