IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Create Dynamic Sort card with Omit condition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 155

PostPosted: Thu Sep 26, 2019 10:06 pm
Reply with quote

Hi Team,
I am in process of creating SORT CARD with Omit condition based on the Number of Inputs/Input. Typically 'OR' should be added at the end when there is more than one input .
Code:


//STEP100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD*
09999
08888
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  SORT FIELDS=COPY
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:5X,SEQNUM,8,ZD)),
               IFTHEN=(WHEN=(86,8,ZD,GT,1),OVERLAY=(81:C’,OR,’))
  OUTFIL REMOVECC,
 HEADER1=(2X,C’SORT FIELDS=COPY’,/,
                  2X,C’OMIT COND=(‘,80:X),
 BUILD=(13X,C’21,05,CH,EQ,C’’’,1,5,C’’’’,80:X),
 SECTIONS=(86,8,HEADER3=(33X,81,4)),
 TRAILER1=(33X,’)’)


I still see the alignment is not proper due to my statments in my header /Build and Trailer statements in my output . Output i got
is

Code:

SORT FIELDS=COPY
OMIT COND=(
                         21,05,CH,EQ,C’09999’
                                                              ,OR,
                         21,05,CH,EQ,C’08888’

                                                               )


I am in process of rearrange my statements on built in cards . Any help is very much appreciated . I saw few samples from our forum but it has dummy records added at the beginning and the end to have logical begin and end of sort card .
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Fri Sep 27, 2019 3:15 am
Reply with quote

Why don’t you use JOINKEYS instead of having too many ORs which is sort of redundant ?

In your SORT CARD you don’t need OMIT COND in HEADER1, just BUILD it for first record only and if you don’t want spaces the SQZ it or don’t add it during the BUILD.
Back to top
View user's profile Send private message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 155

PostPosted: Fri Sep 27, 2019 10:16 am
Reply with quote

Thanks Rohit , will rephrase my statements on Build and will try to acheive my need on this logic.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Fri Sep 27, 2019 8:13 pm
Reply with quote

You can grab idea from this post as well and twist it to work for you.
ibmmainframes.com/viewtopic.php?t=67295&highlight=
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Sat Sep 28, 2019 12:21 am
Reply with quote

Code:
//*============================================
//* SELECT DATA ON VALIDITY LIST               
//*============================================
//SORTJOIN  EXEC PGM=SORT                       
//*                                           
//SYSOUT   DD  SYSOUT=*                       
//*                                           
//VALIDATE DD  *                               
09999                                         
08888                                         
//*                                           
//MASTER   DD  *                               
01111 garbage data                             
08888 good data                               
07777 garbage data                             
05555 garbage data                             
08888 good data                               
09999 good data                               
03333 garbage data                             
00000 garbage data                             
02222 garbage data                             
01111 garbage data                             
09999 good data                               
03333 garbage data                             
04444 garbage data                             
//*                                           
//SORTOUT  DD  SYSOUT=*                       
//*                                           
//SYSIN    DD  *                               
 JOINKEYS F1=MASTER,                           
          FIELDS=(1,5,A)                       
 JOINKEYS F2=VALIDATE,                         
          FIELDS=(1,5,A)                       
*                                             
 REFORMAT FIELDS=(F1:1,80)                     
*                                             
 SORT FIELDS=COPY                             
*                                             
 END                                           
//*     


Code:
********************************* TOP OF DATA *****
08888 good data                                   
08888 good data                                   
09999 good data                                   
09999 good data                                   
******************************** BOTTOM OF DATA ***
Back to top
View user's profile Send private message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 155

PostPosted: Mon Sep 30, 2019 10:41 am
Reply with quote

Rohit Umarjikar wrote:
You can grab idea from this post as well and twist it to work for you.
ibmmainframes.com/viewtopic.php?t=67295&highlight=


Thanks Rohit for the example , here the problem is formatting . I am still working on it .
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Mon Sep 30, 2019 11:55 pm
Reply with quote

balaji81_k, Why are you still struggling creating the dynamic SORT card? I am mean you can always learn this way and you can continue to do that but right away solution is to use JOINKEYs as illustrated to solve the problem in hand.

The JOINKEYs solution is already dynamic in nature .
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Tue Oct 01, 2019 12:22 am
Reply with quote

Rohit Umarjikar wrote:
balaji81_k, Why are you still struggling creating the dynamic SORT card? I am mean you can always learn this way and you can continue to do that but right away solution is to use JOINKEYs as illustrated to solve the problem in hand.

The JOINKEYs solution is already dynamic in nature .


Speaking into the air...
Back to top
View user's profile Send private message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 155

PostPosted: Tue Oct 01, 2019 2:44 pm
Reply with quote

Rohit Umarjikar wrote:
balaji81_k, Why are you still struggling creating the dynamic SORT card? I am mean you can always learn this way and you can continue to do that but right away solution is to use JOINKEYs as illustrated to solve the problem in hand.

The JOINKEYs solution is already dynamic in nature .


Hi Rohit,
Thanks for your valuable time and provide me an example, i come up with simple sort build which has Header and Trailer records with 'Begin' and 'End' and required records is in the body of Omit Condition.

Code:


SORT FIELDS=COPY
OUTREC FIELDS=(13X,C'01,05,CH,EQ,C''',1,5,C'''',C',OR,',80:X)
OUTFIL REMOVECC,
    HEADER1=(2X,C'SORT FIELDS=COPY',/,
             2X,C'OMIT COND=(01,05,CH,EQ,C''',
                C'BEGIN',C'''',C',OR,',80:X)
    TRAILER1=(13X,C'01,05,CH,EQ,C'END  ',C'''',C')',80:X)



This sort card is fine and created required records in body along with Header and Trailer as per Build like
below


Code:


SORT IN DD*
01111
02222

SORT FIELDS=COPY
OMIT COND=(01,05,CH,EQ,C'BEGIN',OR,
                01,05,CH,EQ,C'01111',OR,
                01,05,CH,EQ,C'02222',OR,
                01,05,CH,EQ,C'END   ')


 


This sort build sample is ok for now and it solves my issue .

Thanks
Balaji K
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Wed Oct 02, 2019 7:58 pm
Reply with quote

Very Well. Thanks for posting back the solution.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts How to create a list of SAR jobs with... CA Products 3
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top