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

ICETOOL to Syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Wed Oct 12, 2011 10:30 pm
Reply with quote

Add comma at end of all records except the last
A customer asked the following question:
From DFSORT Tricks - OCT 2011

Can DFSORT insert a comma at the end of all of the records except the last one? For example, say I have a
file with the following three records:
Code:
'2008-07-22.00.37.44.297630'
'2008-07-22.00.37.44.297631'
'2008-08-05.00.40.02.167578'

and I want to write an output file like this:
Code:
'2008-07-22.00.37.44.297630',
'2008-07-22.00.37.44.297631',
'2008-08-05.00.40.02.167578'

How can I do that?
You can use the DATASORT operator of DFSORT's ICETOOL to do this quite easily. Here's the job:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
'2008-07-22.00.37.44.297630'
'2008-07-22.00.37.44.297631'
'2008-08-05.00.40.02.167578'
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) LAST USING(CTL1)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(29:C',')
  SORT FIELDS=(1,1,CH,A)
/*


Can the same be achieved using Syncsort?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Oct 12, 2011 10:37 pm
Reply with quote

Hello,

If you have the current release of Syncsort (1.4 or MFX), try it. . .

If there are questions/problems, post a reply including the informational messages generated by the run.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Oct 13, 2011 11:01 am
Reply with quote

Hi Dick,

It is working fine on Syncsort. But I wanted to know how this can be achieved using SORT (Syncsort). Our shop doesn't use ICETOOL.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Oct 13, 2011 11:50 am
Reply with quote

Quote:
It is working fine on Syncsort. But I wanted to know how this can be achieved using SORT (Syncsort).


huh??

Garry
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 13, 2011 11:54 am
Reply with quote

"Can this ICETOOL code from the DFSORT tricks manual work on vanilla SyncSort (no "tool")?"
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Thu Oct 13, 2011 12:47 pm
Reply with quote

Quote:
It is working fine on Syncsort. But I wanted to know how this can be achieved using SORT (Syncsort). Our shop doesn't use ICETOOL


FYI..
Yes, the job was submitted using the SYNCTOOL. As dick has mentioned version 1.4 & above supports the near DFSORT command, but not all.

In the spool, you can find the relative information on Utility used.

@Bill

Quote:
"Can this ICETOOL code from the DFSORT tricks manual work on vanilla SyncSort (no "tool")?"


Code:
PGM=ICETOOL
needs to be coded, SYNCTOOL will be invoked , performs the operation.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Oct 13, 2011 12:49 pm
Reply with quote

I wanted to know, If this can be converted to PGM=SORT than PGM=ICETOOL.

As in our shop we use only SORT and No ICETOOL
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Oct 13, 2011 1:36 pm
Reply with quote

And I was trying to state gylbharat's question as a clarification.

I'll try again. Remember, it is mostly out of interest only.

There is a task in the DFSORT Tricks manual which is performed with ICETOOL.

At a "shop" which has a ban on ICETOOL (may be an Alias)/SYNCTOOL can the same result be achieved just using the plain SORT (SyncSort).

PS. gylbharat, sorry for spelling your name wrong the other day.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Oct 13, 2011 3:46 pm
Reply with quote

Hi,

if you want to use just SORT, this might help

Code:
//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
'2008-07-22.00.37.44.297630'                                     
'2008-07-22.00.37.44.297631'                                     
'2008-08-05.00.40.02.167578'                                     
/*                                                               
//SORTOUT  DD DSN=&&OUT,DISP=(,PASS),SPACE=(CYL,(10,10),RLSE)   
//SYSIN    DD *                                                 
  SORT FIELDS=(81,8,BI,D)                                       
  INREC OVERLAY=(29:C',',81:SEQNUM,8,ZD)                         
/*                                                               
//STEP0200 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=&&OUT,DISP=(OLD,PASS)                         
//SORTOUT  DD DSN=&&SEQ,DISP=(,PASS),SPACE=(TRK,(1))             
//SYSIN    DD *                                                 
  SORT FIELDS=COPY,STOPAFT=1                                     
  OUTREC BUILD=(C' INREC IFTHEN=(WHEN=(81,08,ZD,EQ,+',           
                81,8,C'),',80:X)                                   
/*                                                                 
//STEP0300 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=&&OUT,DISP=SHR                                   
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=(81,8,BI,A)                                         
/*                                                                 
//         DD DSN=&&SEQ,DISP=SHR                                   
//         DD *                                                   
  OVERLAY=(29:C' '))                                               
  OUTREC BUILD=(1,80)                                             
/*                                                                 



Gerry
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Oct 13, 2011 5:14 pm
Reply with quote

Thanks Gerry...
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Oct 14, 2011 3:39 am
Reply with quote

Hi,

another way of achieving it and it's simpler with no sorting required
Code:
//STEP0001  EXEC PGM=SORT                                               
//SYSOUT    DD SYSOUT=*                                                 
//SORTIN    DD *                                                       
'2008-07-22.00.37.44.297630'                                           
'2008-07-22.00.37.44.297631'                                           
'2008-08-05.00.40.02.167578'                                           
/*                                                                     
//SORTOUT DD DSN=&&S1,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1))         
//SYSIN     DD *                                                       
  SORT FIELDS=COPY                                                     
  OUTFIL REMOVECC,NODETAIL,                                             
  TRAILER1=(C'SEQ#NUM,',X'7D',COUNT=(M11,LENGTH=8),X'7D',80:X)         
/*                                                                     
//STEP0002 EXEC PGM=SORT                                               
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)                                 
//SYMNOUT  DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
'2008-07-22.00.37.44.297630'                                           
'2008-07-22.00.37.44.297631'                                           
'2008-08-05.00.40.02.167578'                                           
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC OVERLAY=(81:SEQNUM,8,ZD)                                       
  OUTREC IFOUTLEN=80,                                                   
         IFTHEN=(WHEN=(81,08,CH,NE,SEQ#NUM),                           
         OVERLAY=(29:C','))                                             
/*                                                                     



Gerry
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
Search our Forums:

Back to Top