Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
JCL sort to Skip n records based on the condition.

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

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Thu Aug 25, 2011 3:27 pm    Post subject: JCL sort to Skip n records based on the condition.
Reply with quote

Hello,

I have a file which i want to copy to new file based on a condition.

i'm try to illustrate with an example lets say that i have a file of length 20 bytes, i should start copying the file to output file sequentially, when the input value in the first 5 byts is 12345 then i should skip 3 records form that line. copy form the 4th record from there.

Input file:
abcde abcdefghijklm1
abcde abcdefghijklm2
12345 dfdfsdfdfd
sdfdsds
dsfdsfdf
abcde abcdefghijklm3
abcde abcdefghijklm4
abcde abcdefghijklm5
abcde abcdefghijklm6
12345 dfdfsdfdfd
sdfdsds
dsfdsfdf
abcde abcdefghijklm7
abcde abcdefghijklm9
abcde abcdefghijklm9

output file:
abcde abcdefghijklm1
abcde abcdefghijklm2
abcde abcdefghijklm3
abcde abcdefghijklm4
abcde abcdefghijklm5
abcde abcdefghijklm6
abcde abcdefghijklm7
abcde abcdefghijklm9
abcde abcdefghijklm9

Can we achive this using sort ?

Thanks in Advance!!!!
Srinath D
Back to top
View user's profile Send private message

Escapa

Senior Member


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

PostPosted: Thu Aug 25, 2011 3:35 pm    Post subject:
Reply with quote

Hi Srinath, Below SORTSTEP will give you desired result.
Input:
Code:
ABCDE ABCDEFGHIJKLM1
ABCDE ABCDEFGHIJKLM2
12345 DFDFSDFDFD   
SDFDSDS             
DSFDSFDF           
ABCDE ABCDEFGHIJKLM3
ABCDE ABCDEFGHIJKLM4
ABCDE ABCDEFGHIJKLM5
ABCDE ABCDEFGHIJKLM6
12345 DFDFSDFDFD   
SDFDSDS             
DSFDSFDF           
ABCDE ABCDEFGHIJKLM7
ABCDE ABCDEFGHIJKLM9
ABCDE ABCDEFGHIJKLM9

SORTSTEP:
Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD DSN=yourinputfilehere,LRECL=20 
//SORTOUT  DD DSN=youroutputfilehere,LRECL=20                                 
//SYSIN    DD *                                         
 OPTION COPY,EQUALS                                     
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'12345'),   
 RECORDS=3,PUSH=(21:SEQ=1))                             
 OUTFIL INCLUDE=(21,1,CH,EQ,C' '),BUILD=(1,20)           
/*                                                       

Output:
Code:

ABCDE ABCDEFGHIJKLM1
ABCDE ABCDEFGHIJKLM2
ABCDE ABCDEFGHIJKLM3
ABCDE ABCDEFGHIJKLM4
ABCDE ABCDEFGHIJKLM5
ABCDE ABCDEFGHIJKLM6
ABCDE ABCDEFGHIJKLM7
ABCDE ABCDEFGHIJKLM9
ABCDE ABCDEFGHIJKLM9
Code:
Back to top
View user's profile Send private message
srinathds83

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Thu Aug 25, 2011 4:09 pm    Post subject:
Reply with quote

Thank you Sambhaji.. it worked.
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 SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Inefficient BUILD - VB records paddin... Daniel Prosser SYNCSORT 7 Thu Dec 14, 2017 3:52 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm

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