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

Select & reformat data in a comma delimited dataset


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Dec 21, 2011 2:07 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Dec 21, 2011 2:14 pm
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 Developer


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

PostPosted: Thu Dec 22, 2011 2:13 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 1
No new posts Store the data for fixed length COBOL Programming 1
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
Search our Forums:

Back to Top