Sort Card to Extract numeric data



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

Sort Card to Extract numeric data

Postby rtammire » Tue Nov 27, 2012 10:35 am

Hi All,

I want to extract numeric data from a record.

Input Record format is as follows
--------------------------------------
Loaded 138 rows into database
Loaded 12345 rows into database
Loaded 1 row into database
Loaded 1234567 rows into database

i want to extract only counts from these records

Expected Output
-------------------
00000138
00012345
00000001
01234567

Can any one please let me know how to get this by using sort card.. Thanks in advance
rtammire
 
Posts: 12
Joined: Tue Nov 27, 2012 1:19 am
Has thanked: 1 time
Been thanked: 0 time

Re: Sort Card to Extract numeric data

 

Re: Sort Card to Extract numeric data

Postby bodatrinadh » Tue Nov 27, 2012 11:12 am

Tammire,

You can try this code

SORT FIELDS=COPY                                 
 INREC PARSE=(%00=(ENDBEFR=C' ',FIXLEN=10),     
              %01=(ENDBEFR=C'ROW',FIXLEN=08)),   
       BUILD=(%01,JFY=(SHIFT=RIGHT))             
 OUTREC BUILD=(1,08,ZD,EDIT=(TTTTTTTT),LENGTH=08)


Note:- Tested on Synsort 1.4.0.1R.
Thanks
-3nadh
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times

Re: Sort Card to Extract numeric data

Postby rtammire » Tue Nov 27, 2012 12:52 pm

Hi Trinadh,

I have tried with the sort card which you have provided. But the thing is counts are not populating correctly in output file.

Please find below the input,output and sort card details

Input:
------
Loaded 13 rows into the database
Loaded 98 rows into the database
Loaded 3 rows into the database
Loaded 94 rows into the database
Loaded 1 rows into the database
Loaded 7 rows into the database
Loaded 51 rows into the database
Loaded 1 rows into the database
Loaded 8 rows into the database

Output:
--------
01309662
09809662
30966209
09409662
10966209
70966209
05109662
10966209
80966209

Sort Card
------------
SORT FIELDS=COPY                                   
 INREC PARSE=(%00=(ENDBEFR=C' ',FIXLEN=10),       
              %01=(ENDBEFR=C'ROW',FIXLEN=08)),     
       BUILD=(%01,JFY=(SHIFT=RIGHT))               
 OUTREC BUILD=(1,08,ZD,EDIT=(TTTTTTTT),LENGTH=08) 


Please let me know where am doing wrong. Thank You

Code'd.
rtammire
 
Posts: 12
Joined: Tue Nov 27, 2012 1:19 am
Has thanked: 1 time
Been thanked: 0 time

Re: Sort Card to Extract numeric data

Postby Pandora-Box » Tue Nov 27, 2012 1:07 pm

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//SORTIN DD *
LOADED 13 ROWS INTO THE DATABASE
LOADED 98 ROWS INTO THE DATABASE
LOADED 3 ROWS INTO THE DATABASE
LOADED 94 ROWS INTO THE DATABASE
LOADED 1 ROWS INTO THE DATABASE
LOADED 7 ROWS INTO THE DATABASE
LOADED 51 ROWS INTO THE DATABASE
LOADED 1 ROWS INTO THE DATABASE
LOADED 8 ROWS INTO THE DATABASE
//SORTOUT DD SYSOUT=*
//SYSOUT  DD SYSOUT=*
//SYSIN   DD *
  SORT FIELDS=COPY
   INREC PARSE=(%00=(ENDBEFR=C' ',FIXLEN=10),
                %01=(ENDBEFR=C'ROW',FIXLEN=08)),
         BUILD=(%01,JFY=(SHIFT=RIGHT))
   OUTREC BUILD=(1,08,ZD,EDIT=(TTTTTTTT),LENGTH=08)


Output

00000013
00000098
00000003
00000094
00000001
00000007
00000051
00000001
00000008


Can you show us your input and output with codetags on before complaining?
User avatar
Pandora-Box
 
Posts: 65
Joined: Fri Feb 10, 2012 8:30 pm
Location: Mars
Has thanked: 3 times
Been thanked: 6 times

Re: Sort Card to Extract numeric data

Postby BillyBoyo » Tue Nov 27, 2012 1:20 pm

"Rows" is in mixed-case, "ROW" on your Sort control card is in upper-case.

When you see unexpected results, try to understand then in the context of what is known. Look at those repeating values. Ask yourself where they come from. What has the same value and follows your numbers, in the data? What are the hex values of whatever follows it, and the values you'd get if you treat them as numbers?

These users thanked the author BillyBoyo for the post:
Pandora-Box (Tue Nov 27, 2012 2:15 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Sort Card to Extract numeric data

Postby rtammire » Tue Nov 27, 2012 2:08 pm

Thanks for providing the solution.. Problem is with UPPER CASE.. now its working fine.. Thanks you
rtammire
 
Posts: 12
Joined: Tue Nov 27, 2012 1:19 am
Has thanked: 1 time
Been thanked: 0 time

Re: Sort Card to Extract numeric data

Postby BillyBoyo » Tue Nov 27, 2012 3:30 pm

You can also try with this:

  SORT FIELDS=COPY
  INREC BUILD=(8,8,UFF,TO=ZD,LENGTH=8)


Have a look at the documentation for UFF and see why it works.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Sort Card to Extract numeric data

Postby BillyBoyo » Tue Nov 27, 2012 3:44 pm

This is overly complex:

 SORT FIELDS=COPY                                   
 INREC PARSE=(%00=(ENDBEFR=C' ',FIXLEN=10),       
              %01=(ENDBEFR=C'ROW',FIXLEN=08)),     
       BUILD=(%01,JFY=(SHIFT=RIGHT))               
 OUTREC BUILD=(1,08,ZD,EDIT=(TTTTTTTT),LENGTH=08)


Here is a simpler version:

 SORT FIELDS=COPY                                   
 INREC PARSE=(%01=(STARTAFT=BLANKS,
                   ENDBEFR=BLANKS,
                   FIXLEN=08)),
      OVERLAY=(1:%01,JFY=(SHIFT=RIGHT),72X,
               1:1,08,ZD,EDIT=(TTTTTTTT))

BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Sort Card to Extract numeric data

Postby rtammire » Tue Nov 27, 2012 9:10 pm

Thanks Billyboyo.. Both the sort cards you have provided are working...But need one more help..:)

My input is like this

Input:

    (DD:INPUT-DODN1.FFB.DCR1.STMT35.LOADSTM)<
Loaded 3 rows into the database             
    (DD:INPUT-DODN1.FFB.DCR1.STMT36.LOADSTM)<
Loaded 94 rows into the database             
(DD:INPUT-DODN1.FFB.DCR1.STMT45.LOADSTM)<   
Loaded 1 rows into the database             
    (DD:INPUT-DODN1.FFB.DCR1.STMT51.LOADSTM)<
Loaded 7 rows into the database             


Expected Output: Need output in below format

STMT35  00000003
STMT36  00000094
STMT45  00000001
STMT51  00000007


Can anyone please help me on this.. it would be very helpfull if we can get output by using sort card.. Thank You

Code'd
rtammire
 
Posts: 12
Joined: Tue Nov 27, 2012 1:19 am
Has thanked: 1 time
Been thanked: 0 time

Re: Sort Card to Extract numeric data

Postby BillyBoyo » Tue Nov 27, 2012 9:42 pm

Have a look at PARSE in you manual. Have a look at WHEN=GROUP. With PARSE you can isolate the 2nd-to-last element of that first line, and with WHEN=GROUP you can PUSH that element so that it is available when processing the next line, from where you then get the number and output the two together. You'll need OUTFIL with OMIT/INCLUDE to get rid of any excess lines (you have two input, for each one output).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post