Syncsort Question



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

Syncsort Question

Postby rayngerfan » Thu Nov 28, 2013 2:06 am

I have a file that contains the following records. The records starts in col 1 - 10 and is FB. I want to extract only the ACCESSORID records that aren't proceeded by a ATTRIBUTRES record. In the below data record ACCESSORID = P000005 wouldn't be extracted because it is proceeded by record ATTRIBUTES = ASUSPEND. These records wouldn't be extracted (ACCESSORID = P000005 , ACCESSORID = PCCCCCC , ACCESSORID = PZZZZZZ). Using SYNCSORT FOR Z/OS 1.4.0.0. Any help is greatly appreciated.


ACCESSORID = P000001
ACCESSORID = P000002
ACCESSORID = P000003
ACCESSORID = P000004
ACCESSORID = P000005
ATTRIBUTES = ASUSPEND
ACCESSORID = PAAAAAA
ACCESSORID = PBBBBBB
ACCESSORID = PCCCCCC
ATTRIBUTES = ASUSPEND
ACCESSORID = PXXXXXX
ACCESSORID = PDDDDDD
ACCESSORID = PRRRRRR
ACCESSORID = PYYYYYY
ACCESSORID = PZZZZZZ
ATTRIBUTES = ASUSPEND


Code'd
rayngerfan
 
Posts: 51
Joined: Fri Apr 17, 2009 4:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Syncsort Question

 

Re: Syncsort Question

Postby Akatsukami » Thu Nov 28, 2013 3:02 am

rayngerfan wrote:I have a file that contains the following records. The records starts in col 1 - 10 and is FB. I want to extract only the ACCESSORID records that aren't succeeded by a ATTRIBUTRES record. In the below data record ACCESSORID = P000005 wouldn't be extracted because it is succeeded by record ATTRIBUTES = ASUSPEND. These records wouldn't be extracted (ACCESSORID = P000005 , ACCESSORID = PCCCCCC , ACCESSORID = PZZZZZZ). Using SYNCSORT FOR Z/OS 1.4.0.0. Any help is greatly appreciated.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Syncsort Question

Postby Thampy » Thu Nov 28, 2013 4:03 am

Please try the below Syncsort JCL. I asssume the input file record length is 80.

//STEP010   EXEC PGM=SORT                                   
//SYSOUT    DD   SYSOUT=*                                   
//SORTIN     DD *                                           
ACCESSORID = P000001                                       
ACCESSORID = P000002                                       
ACCESSORID = P000003                                       
ACCESSORID = P000004                                       
ACCESSORID = P000005                                       
ATTRIBUTES = ASUSPEND                                       
ACCESSORID = PAAAAAA                                       
ACCESSORID = PBBBBBB                                       
ACCESSORID = PCCCCCC                                       
ATTRIBUTES = ASUSPEND                                       
ACCESSORID = PXXXXXX                                       
ACCESSORID = PDDDDDD                                       
ACCESSORID = PRRRRRR                                       
ACCESSORID = PYYYYYY                                       
ACCESSORID = PZZZZZZ                                       
ATTRIBUTES = ASUSPEND                                       
//SYSIN     DD   *                                         
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,10,CH,EQ,C'ACCESSORID'),
                          PUSH=(81:ID=4,85:SEQ=4))         
 SORT FIELDS=(81,4,ZD,A)                       
 SUM FIELDS=(85,4,ZD)                         
 OUTFIL INCLUDE=(85,4,ZD,EQ,1),BUILD=(1,80)
//SORTOUT   DD SYSOUT=*


Code'd
Thampy
 
Posts: 35
Joined: Sat Sep 26, 2009 2:27 pm
Has thanked: 0 time
Been thanked: 3 times

Re: Syncsort Question

Postby BillyBoyo » Thu Nov 28, 2013 4:59 am

It is unclear from your description whether you want the ATTRIBUTES records in the output. You don't say you don't, but they would have the same destructive effect next time you run the job, if kept.

If you file is as simple as that, and will remain so, then you can retain the idea of the SUM but avoid the SORT by using MERGE with a single SORTIN01 DD.

If your file, or your processing, is more complicated, you could have a look at http://ibmmainframes.com/about60582.html.

If your SyncSort was just a little more up-to-date you'd have access to JNFnCNTL files, and you could look at a JOINKEYS solution (follow the links for an example). SyncSort do provide a patch to allow JNFnCNTL for 1.4.0, so as a longer term thing, it would be useful to arrange for that.

Without JOINKEYS, the other solution is possible for you.

The idea is to arrange that each record ends up also containing the data from the previous record. The way you pass data from one record to another is WHEN=GROUP with PUSH. If you just PUSH for every record, you'll have the extra data overwritten before you can use it. So, for alternate records, the entire record is PUSHed into different locations.

For your case, you will then be interested in looking at the "record after". If that record is not ATTRIBUTES, output the correct stored record.

If you do not have a trailer on the file, you will need to create a dummy one. This is done in a simple SORT step prior to this, which has the same file for SORTIN but which will only process the first record.

OPTION COPY,STOPAFT=1
INREC OVERLAY=(C'TRAILER DUMMY')

Give that SORTOUT a DSN.

You then have a dummy trailer, which has the same attributes as your input file on SORTIN, which you can simply concatenate to your actual input on SORTIN.

When you identify TRAILER DUMMY in your code (or whatever actual trailer identifier, if you have one) you output a record if it is not ATTRIBUTES.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Syncsort Question

Postby rayngerfan » Thu Nov 28, 2013 8:02 pm

Hi Thampy & BillyBoyo

I tried the below card which worked.

//SYSIN     DD   *
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,10,CH,EQ,C'ACCESSORID'),
                          PUSH=(81:ID=4,85:SEQ=4))
 SORT FIELDS=(81,4,ZD,A)
 SUM FIELDS=(85,4,ZD)
 OUTFIL INCLUDE=(85,4,ZD,EQ,1),BUILD=(1,80)
//SORTOUT   DD SYSOUT=*


I would like to understand how the parameters work. The ID number for the ACCESSORID record before the ATTRIBUTES record are the same, but the SEQ number is 0002. Not sure how the SUM Fields works?
00010001
00020001
00030001
00040001
00050001
00050002  ( ATTRIBUTES Record)


Thanks for your help
rayngerfan
 
Posts: 51
Joined: Fri Apr 17, 2009 4:57 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post