Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

I want to use condition check in sort.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: I want to use condition check in sort.
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    Post subject:
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    Post subject: Reply to: I want to use condition check in sort.
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    Post subject:
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    Post subject: Reply to: I want to use condition check in sort.
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    Post subject:
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: 1703
Location: Australia

PostPosted: Mon Nov 03, 2008 1:15 pm    Post subject:
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    Post subject: Reply to: I want to use condition check in sort.
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    Post subject:
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    Post subject: Reply to: I want to use condition check in sort.
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/

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    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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us