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
 

 

Selecting & Reformatting KSDS file...

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

New User


Joined: 09 Jul 2008
Posts: 4
Location: pune

PostPosted: Wed Jul 30, 2008 10:53 am    Post subject: Selecting & Reformatting KSDS file...
Reply with quote

Hi all,

I am having a KSDS with variable length records as follows:

10001 ab zzzzz qqqq
10002 cd yyyy rrrrr
10001 ef xxxx ssss
10003 ab uuuu mm
10003 ef vvvv lll
...

PRIMARY KEY is 1st + 2nd fields.


Using DFSORT, I need to select records according to 2nd field, say if 2nd field is "ab" or "ef" & put in another file. Output is as follows:

10001 ab zzzzz qqqq
10001 ef xxxx ssss
10003 ab uuuu mm
10003 ef vvvv lll

Then, Reformat the new file so that output is :

10001 zzzzz xxxx qqqq ssss
10003 uuuu vvvv mm lll


Please help me out in this.


Thanks in advance.
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jul 30, 2008 11:49 am    Post subject:
Reply with quote

I have considered RECFM=FB LRECL=80 for both i/p and o/p.

Code:
//*******************************************************               
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
10001 AB ZZZZZ QQQQ                                                     
10002 CD YYYY  RRRRR                                                   
10001 EF XXXX  SSSS                                                     
10003 AB UUUU  MM                                                       
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
10003 EF VVVV  LLL                                                     
/*                                                                     
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 SPLICE FROM(IN1) TO(OUT) ON(1,5,CH) WITH(16,5) WITH(35,5)-             
    WITHALL                        USING(CP01)                         
/*                                                                     
//CP01CNTL DD   *                                                       
  INCLUDE COND=(7,2,SS,EQ,C'AB,EF')                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(7:2X,81:SEQNUM,8,ZD,RESTART=(1,5))),
         IFTHEN=(WHEN=(81,8,ZD,EQ,1),OVERLAY=(26:16,5)),               
         IFTHEN=(WHEN=(81,8,ZD,EQ,2),OVERLAY=(35:16,5,16:10,5))         
  OUTFIL FNAMES=OUT,BUILD=(1,80)                                       
/*                                                                     


output looks like
Code:
10001    ZZZZZ XXXX      QQQQ     SSSS
10003    UUUU  VVVV      MM       LLL
Back to top
View user's profile Send private message
rahul_bhardwaj

New User


Joined: 09 Jul 2008
Posts: 4
Location: pune

PostPosted: Wed Jul 30, 2008 5:11 pm    Post subject: Thanx a lot
Reply with quote

This solution works fine for RECFM=FB but our file is having RECFM=VB

Will this solution work for RECFM=VB or otherwise, what will be the solution???


Thanks in advance
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jul 30, 2008 5:21 pm    Post subject:
Reply with quote

If i/p and o/p both are VB files, then the following control card should work...(this is not tested)
Code:

//TOOLIN   DD *                                                         
 SPLICE FROM(IN1) TO(OUT) ON(5,5,CH) WITH(20,5) WITH(39,5)-             
    WITHALL                        USING(CP01)                         
/*                                                                     
//CP01CNTL DD   *                                                       
  INCLUDE COND=(11,2,SS,EQ,C'AB,EF')                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(11:2X,85:SEQNUM,8,ZD,RESTART=(1,5))),
         IFTHEN=(WHEN=(85,8,ZD,EQ,1),OVERLAY=(30:16,5)),               
         IFTHEN=(WHEN=(85,8,ZD,EQ,2),OVERLAY=(39:16,5,20:10,5))         
  OUTFIL FNAMES=OUT,BUILD=(1,84)                                       
/*                                                                     
Back to top
View user's profile Send private message
rahul_bhardwaj

New User


Joined: 09 Jul 2008
Posts: 4
Location: pune

PostPosted: Wed Jul 30, 2008 6:11 pm    Post subject:
Reply with quote

thanks... will test & update you on this... thanks again icon_biggrin.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Jul 30, 2008 10:33 pm    Post subject:
Reply with quote

Rahul,

Krisprem's "solution" will not work and does not handle the records as variable-length (he pads them out with blanks which is not what you want to do with variable-length records). This DFSORT/ICETOOL job will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  VSAM V input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(5,5,CH) VSAMTYPE(V) VLENOVLY -
  WITH(17,5) WITH(29,5) USING(CTL1)
/*
//CTL1CNTL DD *
  INCLUDE COND=(11,2,SS,EQ,C'ab,ef')
  INREC IFTHEN=(WHEN=INIT,
     BUILD=(1,4,5:SEQNUM,1,ZD,RESTART=(5,5),6:5)),
    IFTHEN=(WHEN=(5,1,ZD,EQ,1),
     BUILD=(1,4,5:6,5,11:15,5,23:21)),
    IFTHEN=(WHEN=NONE,
     BUILD=(1,4,5:6,5,17:15,5,29:21))
/*


If your input file has these records:

Code:

len|data
24  110001 ab zzzzz qqqq
25  210002 cd yyyy  rrrrr
24  110001 ef xxxx  ssss
22  210003 ab uuuu  mm
23  110003 ef vvvv  lll


Your output file will have these records:

Code:

len|data
32  10001 zzzzz xxxx  qqqq  ssss
31  10003 uuuu  vvvv  mm    lll
Back to top
View user's profile Send private message
rahul_bhardwaj

New User


Joined: 09 Jul 2008
Posts: 4
Location: pune

PostPosted: Thu Jul 31, 2008 5:06 pm    Post subject:
Reply with quote

Thanks Yaeger... this solution works perfectly fine...


thanks for providing the solution...


cHeErS icon_biggrin.gif
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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