Generating dynamic sort card



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

Generating dynamic sort card

Postby Papya01234 » Mon Oct 19, 2015 12:31 pm

Hi,

I am creating a dynamic sort which also needs to remove the duplicates.


OUTFIL REMOVECC,                                                   
  HEADER1=('  SORT FIELDS=COPY ',/,                                 
    '  INCLUDE COND=((1,1,BI,NE,1,1,BI),OR,'),                     
  BUILD=(C'   (4,4,PD,EQ,',1,7,C',AND,244,1,CH,EQ,C''',8,1,C'''),OR,
               ',80:X),                                             
  TRAILER1=('    (1,1,BI,NE,1,1,BI))',                             
                  SUM FIELDS=NONE)       


However I tried to check without SUM FIELDS=NONE and its working.

Please suggest me where I am doing wrong.

Regards,
Balu
Papya01234
 
Posts: 6
Joined: Mon Oct 19, 2015 12:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Generating dynamic sort card

 

Re: Need help in generating dynamic sort card

Postby BillyBoyo » Mon Oct 19, 2015 2:26 pm

To use SUM, you need to use SORT or MERGE, not COPY. If your data is in sequence, your can use MERGE with a single input (SORTIN01).

As an alternative, you can use the OUTFIL reporting functions, with REMOVECC, NODETAIL, SECTIONS and HEADER3.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Need help in generating dynamic sort card

Postby Papya01234 » Mon Oct 19, 2015 2:39 pm

Sorry for the incomplete information mentioned in my previous question.

I am creating a dynamic sort which fetches the data from a PS file

I have a file of 80 byte length from which the data is being picked for creating the dynamic sort.
This is the SYSIN I have used:

//SYSIN DD *                                                           
  OPTION COPY                                                           
  OUTFIL REMOVECC,                                                     
    HEADER1=('  SORT FIELDS=(4,4,PD,A) ',/,                                   
      '  INCLUDE COND=((1,1,BI,NE,1,1,BI),OR,'),                       
    BUILD=(C'   (4,4,PD,EQ,',1,7,C',AND,244,1,CH,EQ,C''',8,1,C'''),OR, *
                 ',80:X),                                               
    TRAILER1=('    (1,1,BI,NE,1,1,BI))')                               
/*                                                         


This is the output that I have got.

SORT FIELDS=(4,4,PD,A)                             
INCLUDE COND=((1,1,BI,NE,1,1,BI),OR,         
 (4,4,PD,EQ,1234563,AND,244,1,CH,EQ,C'P'),OR,
 (4,4,PD,EQ,1234563,AND,244,1,CH,EQ,C'P'),OR,
 (4,4,PD,EQ,1239261,AND,244,1,CH,EQ,C'P'),OR,
 (4,4,PD,EQ,AJU5672,AND,244,1,CH,EQ,C'3'),OR,
  (1,1,BI,NE,1,1,BI)) 


Now since this SYSIN might result in duplicates I want to put one more condition as
SUM FIELDS = NONE

Can you please let me know where I can add this condition.

Regards,
Balesh GG
Papya01234
 
Posts: 6
Joined: Mon Oct 19, 2015 12:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Generating dynamic sort card

Postby NicC » Mon Oct 19, 2015 3:00 pm

topic split and coded.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Generating dynamic sort card

Postby BillyBoyo » Mon Oct 19, 2015 3:26 pm

Do you need to SORT the data because it is out of sequence, or just because you want to use SUM?

Just have the SUM statement, pretty much as you have the SORT statement.

Ideally the order would be INCLUDE, SORT, SUM. However, SORT is clever enough to know things only work in one order, so it is only the human reader who is confused.

INCLUDE COND=/OMIT COND= runs first, to limit the amount of data being processed.

Then INREC.

Then SORT.

Then SUM.

Then OUTREC.

The OUTFIL, which can be multiple.

There are also options, which can be specified via OPTION card or PARM=. Consult your documentation for the full details.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Generating dynamic sort card

Postby Papya01234 » Mon Oct 19, 2015 4:08 pm

I am creating this dynamic sort card one one field. But the file which I will be using for this sort will be having thie field with many combination.

My input to the created dynamic sort will be mentioned below.

1234563, 'P' ABCD
1234563, 'P' PQRS
1234563, 'P' MNOP
1239261, 'P' ABCD
1235672, '3' XYZA

and If I am using the dynamic sort created as mentioned earlier I will get the output as

1234563, 'P' ABCD
1234563, 'P' PQRS
1234563, 'P' MNOP
1239261, 'P' ABCD
1235672, '3' XYZA

But I am looking for output like:

1234563, 'P' ABCD
1239261, 'P' ABCD
1235672, '3' XYZA

can you please help in getting this thing done ?

//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,
HEADER1=(' SORT FIELDS=(4,4,PD,A) ',/,
' INCLUDE COND=((1,1,BI,NE,1,1,BI),OR,'),
BUILD=(C' (4,4,PD,EQ,',1,7,C',AND,244,1,CH,EQ,C''',8,1,C'''),OR, *
',80:X),
TRAILER1=(' (1,1,BI,NE,1,1,BI))')
/*
Papya01234
 
Posts: 6
Joined: Mon Oct 19, 2015 12:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Generating dynamic sort card

Postby BillyBoyo » Mon Oct 19, 2015 5:57 pm

//SYSIN DD *
 OPTION COPY
 OUTFIL REMOVECC,
        HEADER1=(' SORT FIELDS=(4,4,PD,A) ',/,
                 ' SUM FIELDS=NONE',/,
                 ' INCLUDE COND=((1,1,BI,NE,1,1,BI),OR,'),
        BUILD=(C' (4,4,PD,EQ,',1,7,C',AND,244,1,CH,EQ,C''',8,1,C'''),OR, *
                ',80:X),
        TRAILER1=(' (1,1,BI,NE,1,1,BI))')
/*


I haven't tried it, but it should be close.

As I said, it would be better to have INCLUDE, SORT, SUM. This would require the INCLUDE part from the HEADER1, and to move the SORT and SUM to after what you have already in the TRAILER1, which also supports the slash-operator (/).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Generating dynamic sort card

Postby Papya01234 » Wed Oct 21, 2015 9:47 am

Thank you so much, It worked.

Regards,
Balesh GG.
Papya01234
 
Posts: 6
Joined: Mon Oct 19, 2015 12:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Generating dynamic sort card

Postby BillyBoyo » Wed Oct 21, 2015 4:02 pm

Well, you were basically there yourself. Can I assume you found the code somewhere, it basically worked, but you didn't know why/how? If so, we can explain.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Generating dynamic sort card

Postby Papya01234 » Thu Oct 22, 2015 4:39 pm

I found the code in this portal itself but which was not fit for my requirement and Since I was not aware of slash-operator (/) It was difficult for me add more conditions such as removing duplicates and adding conditional operators in Build. So I tried but was not successful. It was a great information from you guys.

Regards,
Balesh GG
Papya01234
 
Posts: 6
Joined: Mon Oct 19, 2015 12:16 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post