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

ICETOOL - select first 5 records from every set


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Elixir

Active User


Joined: 08 Feb 2009
Posts: 116
Location: CHENNAI/NEW JERSEY - INDIA/USA

PostPosted: Wed Nov 02, 2011 12:27 am
Reply with quote

Using ICETOOL is it possible to select first 5 records from every set(using first 3 bytes) of records in the below file,

SET1a
SET1b
SET1c
SET1d
SET1e
SET1f
SET2g
SET3h
SET3i
SET3j
SET3k
SET4l
SET4m
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 Nov 02, 2011 12:51 am
Reply with quote

Hello,

If you want help, you need to provide enough info for someone to use to help. . .

From the "sample input" what should be the output? You mention the first 3 bytes, but they are all the same.

A better explanaton of the "rules" and more representative input/output data may help. Also, mention the recfm and lrecl of the files.
Back to top
View user's profile Send private message
Elixir

Active User


Joined: 08 Feb 2009
Posts: 116
Location: CHENNAI/NEW JERSEY - INDIA/USA

PostPosted: Wed Nov 02, 2011 1:41 am
Reply with quote

The expected output is as below,

SET1a
SET1b
SET1c
SET1d
SET1e
SET2g
SET3h
SET3i
SET3j
SET3k
SET4l
SET4m

Input and output both have same record length of 4 bytes.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Wed Nov 02, 2011 1:45 am
Reply with quote

Hi Elixir,

Use below sort card

Code:
//STEP010  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD  SYSOUT=*                                                 
//DFSMSG   DD  SYSOUT=*                                                 
//INPUT1   DD  *                                                       
SET1A                                                                   
SET1B                                                                   
SET1C                                                                   
SET1D                                                                   
SET1E                                                                   
SET1F                                                                   
SET2G                                                                   
SET3H                                                                   
SET3I                                                                   
SET3J                                                                   
SET3K                                                                   
SET4L                                                                   
SET4M                                                                   
/*                                                                     
//MATCH    DD  SYSOUT=*                                                 
//TOOLIN   DD *                                                         
   COPY FROM(INPUT1) TO(MATCH) USING(CTL1)                           
//CTL1CNTL DD *                                                     
 INREC FIELDS=(1:1,10,21:SEQNUM,10,ZD,START=1,INCR=1,RESTART=(1,4)) 
 OUTFIL FNAMES=MATCH,                                               
 INCLUDE=(21,10,ZD,LE,5),                                           
 OUTREC=(1:1,10)                                                     
/*                                                                   


Output:

Code:
SET1A
SET1B
SET1C
SET1D
SET1E
SET2G
SET3H
SET3I
SET3J
SET3K
SET4L
SET4M



Sai
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 Nov 02, 2011 2:37 am
Reply with quote

Hello,

Quote:
Input and output both have same record length of 4 bytes.
Ah, Errr, Ummm - there are 5 on my screen. . . (i.e. SET4m).

The solution Sai posted may do what you want, but not because you posted anything worth using to help you. . .

Is it really that difficult to post what you actually have and what you want from it. . . icon_sad.gif

d
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Nov 05, 2011 2:44 am
Reply with quote

Elixir,

I don't usually look in this Forum, but I happened to notice it. It would be better to post DFSORT questions in the DFSORT Forum where I hang out.

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN DD DSN=...  input file                                                 
//OUT DD DSN=...  output file                                       
//TOOLIN DD *                                             
SELECT FROM(IN) TO(OUT) ON(1,4,CH) FIRST(5)               
/*


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:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
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
Search our Forums:

Back to Top