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

Build Dynamic Sort output and limit ',' character


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: 141

PostPosted: Sat Feb 02, 2019 4:40 am
Reply with quote

Hi Team,
I am building the Sort join card which match two input files which is of RECFM=FB and LRECL= 80 Bytes and creates the output file on Non matching records from File [F1] . This output will be used along with the SQL query with respect to condition on 'IN' Clause .

File F1 :
Code:


-----------------------------------
2018-01-19
2018-01-22
------------------------------------







File F2:-
Code:


-----------------------------------------------
2019-01-19 2018-01-20
2019-01-22 2018-01-22
-----------------------------------------------


SORT CARD:-

Code:


OPTION COPY
INREC OVERLAY=(25:C',')
JOINKEYS FILES=F1,FIELDS=(01,10,A)
JOINKEYS FILES=F2,FIELDS=(12,10,A)
JOIN UNPAIRED,F1,ONLY
REFORMAT FIELDS=(F1:01,10,?)
OUTFIL FNAMES=SORTOUT,INCLUDE=(11,1,CH,EQ,C'1'),NULLOFL=RC4,
REMOVECC,
HEADER1=(10:'('),
BUILD=(11:X'7D',
             12:01,10,
             22:X'7D',
             23:25,01,80:X),
TRAILER1=(10:')')




Is there a way not to add ',' if the count is not > 1 record and format the output with ',' character accordingly

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

Active Member


Joined: 29 Apr 2008
Posts: 939
Location: Maryland

PostPosted: Sat Feb 02, 2019 7:24 pm
Reply with quote

First of all, re-order your statements in the sequence they are really used by SORT utility. Otherwise it takes long time trying to understand the actual behavior of your example, and the final result. It doesn't worth to spend so much time for others to analyze any dirty code.
Code:
 JOINKEYS ...
 JOINKEYS ...
 JOIN ...
 REFORMAT ...
 INREC OVERLAY=(25:C',')
 SORT FIELDS=COPY
 OUTFIL FNAMES=SORTOUT,
        INCLUDE=(11,1,CH,EQ,C'1'),
        NULLOFL=RC4,
        REMOVECC,
        HEADER1=(10:'('),
        BUILD=(11:X'7D',
               12:01,10,
               22:X'7D',
               23:25,01,80:X),
        TRAILER1=(10:')')
 END
Back to top
View user's profile Send private message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 141

PostPosted: Mon Feb 18, 2019 9:08 am
Reply with quote

Hi Team,
I come up with a solution to limit ',' using ICE TOOL . Here is the cntl card info
Assume that the input is of below format

Code:

IN1 DD *
'2018-01-01'
'2019-01-01'



Code:


TOOLIN DD*
DATASORT FROM(IN1) TO(OUT1) LAST USING(CTL1)

CTL1 CNTL DD *

INREC OVERLAY=(13:C',')
SORT FIELDS=(1,12,CH,A),EQUALS
SUM FIELDS=(NONE)
OUTFIL FNAMES=OUT1,REMOVECC,
HEADER1=(10:'('),
BUILD=(11:01,13,80:X),
TRAILER1=(10:')')

Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Feb 20, 2019 10:05 pm
Reply with quote

balaji81_k.

Or you could add a dummy value in the TRAILER1 in your original control card. REFORMAT and '?-match marker' are not needed if you are interested only in non-matching records from one of the inputs (F1 in this case).
Code:
//SYSIN    DD   *                 
 JOINKEYS FILES=F1,FIELDS=(01,10,A)
 JOINKEYS FILES=F2,FIELDS=(12,10,A)
 JOIN UNPAIRED,F1,ONLY             
 OPTION COPY                       
 OUTFIL NULLOFL=RC4,               
 REMOVECC,                         
 HEADER1=(10:'('),                 
 BUILD=(11:C'''',1,10,C''',',80:X),
 TRAILER1=(11:'''0001-01-01'')')   
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 Writng matched records into output fi... DFSORT/ICETOOL 5
No new posts Building a sort key DFSORT/ICETOOL 3
No new posts Very Large Sort failed - Seeking reco... DFSORT/ICETOOL 7
No new posts Date conversion using SORT SYNCSORT 4
No new posts Which SORT utility can improve the Pe... DFSORT/ICETOOL 16
Search our Forums:

Back to Top