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
 

 

Select & reformat data in a comma delimited dataset

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

New User


Joined: 21 Dec 2011
Posts: 2
Location: Australia

PostPosted: Wed Dec 21, 2011 1:54 pm    Post subject: Select & reformat data in a comma delimited dataset
Reply with quote

Hi,

I've not had much experience at writing DFSORT SYSIN cmds beyond the real basic cmds, so I was wondering if someone could provide some assistance.

I'm trying to extract certain records from the VSI data returned from a BVIR request against a VTS cluster in a IBM GRID.

The input dset is LRECL=640,RECFM=FB.

Here are 2 sample records:

Code:
H10001,0,2011-04-29-12.05.40.954341,-1,-1,-1,0,Y,94,N,133,N,N,N,N,N,N,N,N,I,D,N,N,N,N,N,N,W,....... (don't care about the rest)
H10084,0,2011-11-19-08.52.14.532215,-1,-1,-1,0,N,110,N,130,N,N,N,N,N,N,N,N,I,D,D,N,N,N,N,N,N,......

* The 1st 5 records in the dset are header or info records and can be skipped.

What I'm after are just those records that have either either W or M in field %28 (the last field shown in the examples above).

In the output record I want to keep fields:

%01, %02, %03, %08, %10, %12, %13, %14, %20, %21, %22 & %28

and for the output record to be blank delimited rather than comma delimited:

Code:
H10001 0 2011-04-29-12.05.40.954341 Y N N N N I D N N W
H10084 0 2011-11-19-08.52.14.532215 N N N N N I D D N N

There is no need to sort the output records.

Thankyou
Barry...
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10278
Location: italy

PostPosted: Wed Dec 21, 2011 2:07 pm    Post subject: Reply to: Select & reformat data in a comma delimited da
Reply with quote

to help people willing to answer understand better the data
it would be thoughtful to enclose the data within the code tags in order to preserve the alignment
( Your post was edited for it )
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Dec 21, 2011 2:14 pm    Post subject: Reply to: Select & reformat data in a comma delimited da
Reply with quote

Code:

//VSIDATA EXEC PGM=SORT                     
//SYSOUT   Dd DSN=an output dataset                       
//SORTIN   DD DSN=your dsn etc
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                           
  OPTION COPY,SKIPREC=5   
  INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=6), 
               %02=(ENDBEFR=C',',FIXLEN=1), 
               %03=(ENDBEFR=C',',FIXLEN=26)),
        BUILD=(%01,X,%02,X,%03)                   
//*


You could experiment with something along the lines of the above.
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: Thu Dec 22, 2011 2:13 am    Post subject:
Reply with quote

Barry,

The number of % fields you say you want is 12, but your output shows 13 fields. Assuming you do want the 12 fields you listed, you can use a DFSORT job like the following. If you want 13 fields, change appropriately.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/640)
//SORTOUT DD DSN=...  output file (FB/640)
//SYSIN DD *
  OPTION COPY,SKIPREC=5
  INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=10),
               %02=(ENDBEFR=C',',FIXLEN=1),
               %03=(ENDBEFR=C',',FIXLEN=26),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C','),
               %08=(ENDBEFR=C',',FIXLEN=1),
               %=(ENDBEFR=C','),
               %10=(ENDBEFR=C',',FIXLEN=1),
               %=(ENDBEFR=C','),
               %12=(ENDBEFR=C',',FIXLEN=1),
               %13=(ENDBEFR=C',',FIXLEN=1),
               %14=(ENDBEFR=C',',FIXLEN=1),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C','),
               %20=(ENDBEFR=C',',FIXLEN=1),
               %21=(ENDBEFR=C',',FIXLEN=1),
               %22=(ENDBEFR=C',',FIXLEN=1),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C','),
               %=(ENDBEFR=C',',FIXLEN=1),
               %28=(ENDBEFR=C',',FIXLEN=1)),
  BUILD=(%01,X,%02,X,%03,X,%08,X,%10,X,
         %12,X,%13,X,%14,X,%20,X,%21,X,
         %22,X,%28)
  OUTFIL INCLUDE=(57,1,SS,EQ,C'WM'),
    BUILD=(1,57,SQZ=(SHIFT=LEFT,MID=C' '),640:X)
/*
Back to top
View user's profile Send private message
Barry Gilder

New User


Joined: 21 Dec 2011
Posts: 2
Location: Australia

PostPosted: Thu Dec 22, 2011 11:52 am    Post subject:
Reply with quote

Thankyou Enrico for fixing up my post.

Frank,

Thanks VERY, VERY Muchly.

You are correct in that I only want 12 fields not 13.

Although the 1st field is only 6 bytes not 10, after fixing that & the OUTFIL stmt accordingly your code worked perfectly. Again thankyou.

Barry...
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 Unable to copy data from spool in a d... srikant314 JCL & VSAM 2 Fri Jul 28, 2017 9:10 pm
No new posts Paasing symbolic parameter to instrea... Robert Sample JCL & VSAM 2 Thu Jul 27, 2017 1:22 pm
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 3 Wed Jul 26, 2017 9:11 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts copying data without knowing location Arun Raj DFSORT/ICETOOL 12 Thu Jul 20, 2017 1:03 pm


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