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

I want to use condition check in sort.


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

New User


Joined: 21 Oct 2008
Posts: 4
Location: India

PostPosted: Mon Nov 03, 2008 11:21 am
Reply with quote

Hi! I have a problem related to SORT utility. I want to check certain conditions while copying from sortin to sortout.
If the condition satisfies, then i need a particular character constant in a particular position of the output rec. If the condition is not satisfied, then it should copy the input rec as it is as per the position specified in the outrec.
Could anyone help me on this?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Nov 03, 2008 11:26 am
Reply with quote

You need to post sample input data with file specification like LRECL, RECFM and also expected output.
Back to top
View user's profile Send private message
amardeep_sahoo

New User


Joined: 21 Oct 2008
Posts: 4
Location: India

PostPosted: Mon Nov 03, 2008 11:42 am
Reply with quote

Input data I have is as below:

2008103018500313502008103022595379PAL00015612632FE
2008103018500313502008103022595379PAL01023277632FE
2008103018500313502008103022595379PAL04016452632FE

In the output dataset, I want
1. At the first 9 positions in the output file, I want the 9 characters from position 37 of the input file.
2. I want the records to be copied into the output file starting from the 22nd record in the output file.
2. At the end, I want to have a ')' symbol in the output file.

The file should look like this:

.
.
.
.
L00015612 (This should be the 22nd record in the outputfile)
L01023277
L04016452
)
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Nov 03, 2008 11:51 am
Reply with quote

Does output dataset is already present and have 21 records?
or it has many records and you want to insert your records starting from 22nd record?
Back to top
View user's profile Send private message
amardeep_sahoo

New User


Joined: 21 Oct 2008
Posts: 4
Location: India

PostPosted: Mon Nov 03, 2008 12:52 pm
Reply with quote

The output dataset is already present and already has 21 records.
I want to start inserting from the 22nd record.
Back to top
View user's profile Send private message
keyarika

New User


Joined: 24 May 2008
Posts: 10
Location: bangalore

PostPosted: Mon Nov 03, 2008 1:03 pm
Reply with quote

Hi,
Have you treid anything!!
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Nov 03, 2008 1:15 pm
Reply with quote

Hi,

Quote:
I want to check certain conditions while copying from sortin to sortout.

Can you elaborate on this ?


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

New User


Joined: 21 Oct 2008
Posts: 4
Location: India

PostPosted: Mon Nov 03, 2008 4:00 pm
Reply with quote

I have just tried
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:37,9)
SUM FIELDS=NONE
/*

This only copies the fields starting from position 37 till 9 characters into the output file.
But I need the sort to start writing from record 22 in the output file and at the end of the list I need it to insert a ')' symbol.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Nov 03, 2008 5:52 pm
Reply with quote

I assume you need first 21 lines of output file as blank records and then required records and last record as '('
Code:

//S1   EXEC  PGM=ICETOOL                                     
//TOOLMSG   DD  SYSOUT=*                                     
//DFSMSG    DD  SYSOUT=*                                     
//INP1  DD *                                                 
2008103018500313502008103022595379PAL00015612632FE           
2008103018500313502008103022595379PAL01023277632FE           
2008103018500313502008103022595379PAL04016452632FE           
/*                                                           
//INP2  DD *                                                 
DUMMY RECORD                                                 
/*                                                           
//OUT1 DD DSN=outputfilename,DISP=(MOD,CATLG,DELETE),
//        LRECL=80,RECFM=FBA                                 
//TOOLIN DD *                                               
   COPY FROM(INP2) TO(OUT1) USING(CTL1)                     
   COPY FROM(INP1) TO(OUT1) USING(CTL2)                     
/*                                                           
//CTL1CNTL DD *                             
  OPTION COPY                               
  OUTFIL FNAMES=OUT1,REPEAT=21,BUILD=(80X) 
/*                                         
//CTL2CNTL DD *                             
  INREC FIELDS=(37,9,80:X)                 
  OUTFIL FNAMES=OUT1,REMOVECC,TRAILER1=('(')
/*                                         

Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Nov 03, 2008 11:29 pm
Reply with quote

You can do this kind of thing quite easily and efficiently with the new DATASORT function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this. The first 21 records are copied as is and starting from 22nd record we take 9 bytes from pos 37 and sort and remove the duplicates and append a ')' at the end of the list.

Code:

//STEP0100 EXEC PGM=ICETOOL                             
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN       DD *                                         
RECORD 01                                               
RECORD 02                                               
RECORD 03                                               
RECORD 04                                               
RECORD 05                                               
RECORD 06                                               
RECORD 07                                               
RECORD 08                                               
RECORD 09                                               
RECORD 10                                               
RECORD 11                                               
RECORD 12                                               
RECORD 13                                               
RECORD 14                                               
RECORD 15                                               
RECORD 16                                               
RECORD 17                                               
RECORD 18                                               
RECORD 19                                               
RECORD 20                                               
RECORD 21                                               
2008103018500313502008103022595379PAL00015612632FE     
2008103018500313502008103022595379PAL00015612632FE     
2008103018500313502008103022595379PAL01023277632FE     
2008103018500313502008103022595379PAL01023277632FE     
2008103018500313502008103022595379PAL04016452632FE     
//OUT      DD SYSOUT=*                                 
//TOOLIN   DD *                                   
 DATASORT FROM(IN) TO(OUT) HEADER(21) USING(CTL1)
//CTL1CNTL DD *                                   
  INREC BUILD=(37,9,80:X)                         
  SORT FIELDS=(1,9,CH,A)                         
  SUM FIELDS=NONE                                 
  OUTFIL FNAMES=OUT,REMOVECC,TRAILER1=(')')
/*                                               


The output from this job is

Code:

RECORD 01       
RECORD 02       
RECORD 03       
RECORD 04       
RECORD 05       
RECORD 06       
RECORD 07       
RECORD 08       
RECORD 09       
RECORD 10       
RECORD 11       
RECORD 12       
RECORD 13       
RECORD 14       
RECORD 15       
RECORD 16       
RECORD 17       
RECORD 18       
RECORD 19       
RECORD 20       
RECORD 21       
L00015612       
L01023277       
L04016452       
)               


For complete details on the new DATASORT and the other new functions available with PTF UK90013, see:

Use [URL] BBCode for External Links

Hope this helps...

Cheers
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top