JCL to get only selected records from a ds --- without key

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
bhargavi_ns
Member
Posts: 18
Joined: Wed Sep 21, 2011 9:47 am

JCL to get only selected records from a ds --- without key

Post by bhargavi_ns » Wed Nov 09, 2011 8:08 pm

I have a file in which there are 20 records.

I want to extract only the 7th, 11th and 16th record.

Is it possible to get these records without any key characters in those records.

Can anyone please suggest me a JCL to do the above.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Nov 09, 2011 10:25 pm

Suggest you simply copy the file and delete what you don't want. . .

What happens when some records are added or deleted and the "record number" changes?

No jcl can do what you want - some utility probably can. But if there are no rules, a utility will not be of much use.

What business requirement might this help with? Or is this just a curiosity?

If you more clearly explain why hard-coded record numbers exist, someone may have a more useful suggestion.
Have a good one

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Nov 09, 2011 10:32 pm

bhargavi_ns,

You can use the SUBSET operator of DFSORT's ICETOOL to do that:

Code: Select all

//S1    EXEC  PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *                                               
SUBSET FROM(IN) TO(OUT) KEEP INPUT RRN(7) RRN(11) RRN(16)   
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

syedwasim
Member
Posts: 2
Joined: Thu Oct 27, 2011 1:10 am

Post by syedwasim » Fri Dec 09, 2011 12:19 pm

Frank Yaeger wrote:bhargavi_ns,

You can use the SUBSET operator of DFSORT's ICETOOL to do that:

Code: Select all

//S1    EXEC  PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *                                               
SUBSET FROM(IN) TO(OUT) KEEP INPUT RRN(7) RRN(11) RRN(16)   
/*
There is a sequential file with record length 80.Now i want to extract first 40 characters of the record.how can i do that
syed wasim

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Fri Dec 09, 2011 12:32 pm

When you have a question, you need to start a new tpoic for the new question. You should not just append to some unrelated existing topic. . .

dd

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Fri Dec 09, 2011 1:18 pm

Please follow what DikDude has suggested. Unfortunately, I can't split this post; on the other hand to get you going - when you ask such a question, please more details such as - if your input file FB or VB?

If it's FB, use:

Code: Select all

//SYSIN    DD *      
  OPTION COPY        
  INREC FIELDS=(1,40)
If it's VB, use:

Code: Select all

//SYSIN    DD *      
  OPTION COPY        
  INREC FIELDS=(1,44)
Regards,
Anuj

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Dec 09, 2011 10:41 pm

syed wasim,

If this does actually have something to do with the job you quoted, and you want to extract the first 40 bytes of each selected FB record, you can use a DFSORT/ICETOOL job like the following:

Code: Select all

//S1    EXEC  PGM=ICETOOL                                  
//TOOLMSG DD SYSOUT=*                                      
//DFSMSG  DD SYSOUT=*                                      
//IN DD DSN=...  input file 
//OUT DD DSN=...  output file 
//TOOLIN DD *                                                
SUBSET FROM(IN) TO(OUT) KEEP INPUT RRN(7) RRN(11) RRN(16) USING(CTL1)
/* 
//CTL1CNTL DD *
   INREC BUILD=(1,40)
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others