Syncsort numeric processing



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Syncsort numeric processing

Postby Doug » Thu Apr 15, 2010 11:02 pm

My input fields are coming in like this
342.42
178.5
178.5
178.5
2432.05
0
0

I would like to translate these into a usable numeric number.

I am not sure which keyword I should be using (edit? , overlay?)

Any help is appreciated.

Thanks, Doug
Doug
 
Posts: 8
Joined: Thu Apr 15, 2010 10:40 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Syncsort numeric processing

 

Re: Syncsort numeric processing

Postby dick scherrer » Fri Apr 16, 2010 12:29 am

Hello and welcome to the forum,

I would like to translate these into a usable numeric number.

What output do you want from that "input"?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6308
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 90 times

Re: Syncsort numeric processing

Postby Doug » Fri Apr 16, 2010 12:37 am

a packed decimal field would be fine....

or even a similar floating point number but where the decimal is consistently in the same spot.

Thanks, Doug
Doug
 
Posts: 8
Joined: Thu Apr 15, 2010 10:40 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Syncsort numeric processing

Postby Alissa Margulies » Fri Apr 16, 2010 12:43 am

The following code produces the output below:
//STEP1 EXEC PGM=SORT       
//SYSOUT  DD SYSOUT=*       
//SORTOUT DD SYSOUT=*       
//SORTIN  DD *             
342.42                     
178.5                       
178.5                       
178.5                       
2432.05                     
0                           
0                           
//SYSIN   DD *             
   SORT FIELDS=COPY         
   INREC FIELDS=(1,7,UFF,ZD)
/*                         

0034242
0001785
0001785
0001785
0243205
0000000
0000000

If so desired, you can then use OUTREC to insert the decimal point.
Please let us know if this is example is helpful or if you require further assistance.
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: Syncsort numeric processing

Postby Doug » Fri Apr 16, 2010 12:50 am

Hi Alissa,
This solution gives the wrong output for 178.5

The output should be 0017850


I also should hae included an example with no decimal at all.... say 225

This should come out as 0022500 to be of any use.

Thanks anyways,
Doug
Doug
 
Posts: 8
Joined: Thu Apr 15, 2010 10:40 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Syncsort numeric processing

Postby Alissa Margulies » Fri Apr 16, 2010 1:26 am

Give this one a try:
//SORT   EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
342.42                                                   
178.5                                                   
2432.05 
255                                               
0                                                       
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  INREC IFTHEN=(WHEN=INIT,                               
  PARSE=(%01=(ENDBEFR=C'.',FIXLEN=4),                   
         %02=(ENDBEFR=C' ',FIXLEN=2))),                 
   IFTHEN=(WHEN=INIT,                                   
   BUILD=(1:%01,JFY=(SHIFT=RIGHT),                       
          5:C'.',                                       
          6:%02,JFY=(SHIFT=LEFT)))                       
   SORT FIELDS=COPY                                     
   OUTREC FINDREP=(INOUT=(C' ',C'0'),STARTPOS=1,ENDPOS=7)
//*                                                     

The following is the output produced by the above job:
0342.42
0178.50
2432.05
0255.00
0000.00

If you do not want the decimal point in the output, then you can use the following modified code instead:
//SYSIN    DD *                                           
  INREC IFTHEN=(WHEN=INIT,                               
  PARSE=(%01=(ENDBEFR=C'.',FIXLEN=4),                     
         %02=(ENDBEFR=C' ',FIXLEN=2))),                   
   IFTHEN=(WHEN=INIT,                                     
   BUILD=(1:%01,JFY=(SHIFT=RIGHT),                       
          5:%02,JFY=(SHIFT=LEFT)))                       
   SORT FIELDS=COPY                                       
   OUTREC FINDREP=(INOUT=(C' ',C'0'),STARTPOS=1,ENDPOS=6)
//*                                                       

And here is the new output:
034242
017850
243205
025500
000000
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: Syncsort numeric processing

Postby Doug » Fri Apr 16, 2010 7:17 pm

Hi Alissa,
It looks like this solution will work fine... :)

Let's say the numeric field I am fixing up starts in column 27 and goes for a length of 8.

How would the inrec clause look then??


Thanks, Doug
Doug
 
Posts: 8
Joined: Thu Apr 15, 2010 10:40 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Syncsort numeric processing

Postby Alissa Margulies » Fri Apr 16, 2010 9:07 pm

Hi Doug.

Please see this example:
//SORT   EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
XXXXXXXXXXXXXXXXXXXXXXXXXX31242.42                         
YYYYYYYYYYYYYYYYYYYYYYYYYY178.5                           
ZZZZZZZZZZZZZZZZZZZZZZZZZZ2432.05                         
AAAAAAAAAAAAAAAAAAAAAAAAAA255                             
BBBBBBBBBBBBBBBBBBBBBBBBBB0                               
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  INREC IFTHEN=(WHEN=INIT,                                 
  PARSE=(%00=(FIXLEN=26),                                 
         %01=(ENDBEFR=C'.',FIXLEN=5),                     
         %02=(ENDBEFR=C' ',FIXLEN=2))),                   
   IFTHEN=(WHEN=INIT,                                     
   BUILD=(1:%00,                                           
         27:%01,JFY=(SHIFT=RIGHT),                         
         32:%02,JFY=(SHIFT=LEFT)))                         
   SORT FIELDS=COPY                                       
   OUTREC FINDREP=(INOUT=(C' ',C'0'),STARTPOS=27,ENDPOS=33)
//*                                                       

Output produced:
XXXXXXXXXXXXXXXXXXXXXXXXXX3124242
YYYYYYYYYYYYYYYYYYYYYYYYYY0017850
ZZZZZZZZZZZZZZZZZZZZZZZZZZ0243205
AAAAAAAAAAAAAAAAAAAAAAAAAA0025500
BBBBBBBBBBBBBBBBBBBBBBBBBB0000000

If this does not provide you with the answer, then please show some sample input records along with your expected output.

Thank you & regards,
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: Syncsort numeric processing

Postby Doug » Tue Apr 20, 2010 12:03 am

Hi Alissa,
This solution worked fine when I was only fixing one field.
When I tried to apply the principle to the next field I got very weird output.

Here is my input file

----+----1----+----2----+----3----+----4----+
9      0            0               0       
9      618.48   CAD 0               0       
9      57.22    CAD 0               0       
9V1046 85.58    CAD 0               0       
9      156.79   CAD 0               0       
9      144.48   CAD 0               0       
9      202.6    CAD 202.6    PDR    0       
9      24.71    CAD 0               0       
944021 14930.49 USD 0               0       
97802  300      USD 0               0       


My 1st amount that needs to be fixed is in col 7-16
2nd amount is in col 20-29
3rd amount is in col 36-45


My expected output would be
----+----1----+----2----+----3----+----4----+
9     0000000.00   0000000.00      0000000.00
9     0000618.48CAD0000000.00      0000000.00
9     0000057.22CAD0000000.00      0000000.00
9V10460000085.58CAD0000000.00      0000000.00
9     0000156.79CAD0000000.00      0000000.00
9     0000144.48CAD0000000.00      0000000.00
9     0000202.60CAD0000202.60PDR   0000000.00
9     0000024.71CAD0000000.00      0000000.00
9440210014930.49USD0000000.00      0000000.00
97802 0000300.00USD0000000.00      0000000.00


Thanks for all of your suggestions.
Doug
Doug
 
Posts: 8
Joined: Thu Apr 15, 2010 10:40 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Syncsort numeric processing

Postby dick scherrer » Tue Apr 20, 2010 12:04 am

Hello,

What actually was output?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6308
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 90 times

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post