Page 1 of 1

Length VB file records

PostPosted: Wed Aug 12, 2015 3:00 pm
by gauravfrankly
I have a VB file as input and want to get output with length of each record in VB file.
Can you please give me a sort JCL to do this.
How we could use RDW to get this Length.

Re: Length VB file records

PostPosted: Wed Aug 12, 2015 3:38 pm
by NicC
What have you tried so far? Have you looked up the format of the RDW?
I presume you do not actually want the sirt JCL, as that is very clearly explained in the manual, but the sort control cards (which are not JCL).

Re: Length VB file records

PostPosted: Wed Aug 12, 2015 3:56 pm
by gauravfrankly
Sorry, Nicc. can you please give me sort control card to fetch the length from RDW.
I didn't got any thing by googling it.

Re: Length VB file records

PostPosted: Wed Aug 12, 2015 4:03 pm
by gauravfrankly
http://www.caliberdt.com/tips/Aug05_Var ... DW_BDW.htm

can you plz explain, what they trying to do. just click th link!!

Re: Length VB file records

PostPosted: Wed Aug 12, 2015 5:16 pm
by BillyBoyo
 OPTION COPY
 OUTFIL VTOF,BUILD=(1,2,BI,ZD,LENGTH=5)


The record-length is a binary value in the first two bytes of the RDW (Record Descriptor Word). The above will produce fixed-length records of five bytes which contain the record-length.

What do you actually want to do with the record-length?

Re: Length VB file records

PostPosted: Wed Aug 12, 2015 6:21 pm
by steve-myers
gauravfrankly - we try to avoid links to non IBM web sites here. Many of us will not follow these links.

I have to echo Billyboyo: what do you propose to do with this data? Most use of this data that I can imagine is purely statistical in nature: what is the average length of data records? What are the shortest and/or the longest record lengths?

Billyboyo - Will DFSORT produce a true zoned decimal value or does it produce a zoned decimal value with the alternate "sign" X'Fx' rather than X'Cx'?

Re: Length VB file records

PostPosted: Wed Aug 12, 2015 7:00 pm
by BillyBoyo
In this instance, it will produce an X'Fx'. If you want the X'Cx', you can use ZDC instead of ZD as the "TO" field-type.

ZD is a data-type, where it is associated with a start-position and a length. TO=ZD is a conversion. It converts contextually. If it is the wrong conversion for the task, or by choice, TO=ZDF or TO=ZDC may be used. ZD without a start and a length is a conversion (as in my example) short for TO=ZD. In this context it will produce an "unsigned" value - if I wanted a signed value, I would make the conversion TO=ZDC, or plain ZDC, in place of the ZD.

I usually include the TO= to make things clearer. As an expedient (since it was handy) I copied and amended someone else's code, which does the job, but doesn't have the TO=. :-)

Re: Length VB file records

PostPosted: Mon Aug 17, 2015 3:40 pm
by gauravfrankly
Billy,
I need to insert the length into DB. and I want a datset like following:
input:
gaurav
billy
frank
output:
gaurav 06
billy 05
frank 05

Re: Length VB file records

PostPosted: Mon Aug 17, 2015 5:12 pm
by BillyBoyo
Assuming you input is a variable-length dataset:

  OPTION COPY
  INREC  IFTHEN=(WHEN=INIT,
                 OVERLAY=(31:1,2,BI,SUB,+4,TO=ZD,LENGTH=2))
  OUTFIL VTOF,BUILD=(5,32)


You'd need to subtract four from the record-length (to account for the RDW). I've assumed you want the output in fixed positions.