Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Create Dynamic Sort card with Omit condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 141

PostPosted: Thu Sep 26, 2019 10:06 pm    Post subject: Create Dynamic Sort card with Omit condition
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

Senior Member


Joined: 21 Sep 2010
Posts: 2262
Location: NY,USA

PostPosted: Fri Sep 27, 2019 3:15 am    Post subject:
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: 141

PostPosted: Fri Sep 27, 2019 10:16 am    Post subject: Reply to: Create Dynamic Sort card with Omit condition
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

Senior Member


Joined: 21 Sep 2010
Posts: 2262
Location: NY,USA

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

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

Active Member


Joined: 29 Apr 2008
Posts: 552
Location: Maryland

PostPosted: Sat Sep 28, 2019 12:21 am    Post subject:
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: 141

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

Rohit Umarjikar wrote:
You can grab idea from this post as well and twist it to work for you.
http://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

Senior Member


Joined: 21 Sep 2010
Posts: 2262
Location: NY,USA

PostPosted: Mon Sep 30, 2019 11:55 pm    Post subject:
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

Active Member


Joined: 29 Apr 2008
Posts: 552
Location: Maryland

PostPosted: Tue Oct 01, 2019 12:22 am    Post subject:
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: 141

PostPosted: Tue Oct 01, 2019 2:44 pm    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 2262
Location: NY,USA

PostPosted: Wed Oct 02, 2019 7:58 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts One-One matching using SORT dearlux SYNCSORT 6 Fri Oct 11, 2019 12:11 am
No new posts Trying to document a weird condition ... John Poulakos CICS 0 Fri Aug 30, 2019 11:19 pm
No new posts need assistance on a sort rajiv rengasamy SYNCSORT 11 Fri Jul 26, 2019 8:19 pm
No new posts need help with a tricky sort - Continued rajiv rengasamy SYNCSORT 8 Tue Jul 16, 2019 1:26 pm
No new posts Sort records within a data block rajiv rengasamy DFSORT/ICETOOL 0 Fri Jul 12, 2019 3:25 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us