Page 1 of 1

Can we copy a FBA file to FB file using a JCL?

Posted: Thu May 21, 2015 6:44 pm
by Munnalal
Hi All,

I have a file which is in FBA format. It is a dataset of length 81. Now my application is modified and it would need a file with FB format. Can you please tell me if I want to copy the data into the FB file how can I do that?

Thanks.

Re: Can we copy a FBA file to FB file using a JCL?

Posted: Thu May 21, 2015 7:22 pm
by zprogrammer
Do you just need a plain copy to FB formatted Output file or do you need to alter the record length as well?

Re: Can we copy a FBA file to FB file using a JCL?

Posted: Fri May 22, 2015 11:47 am
by Munnalal
THanks for the reply.

If you can suggest both it will help in the long run. I have not thought that I could get 81 as lrecl too. As of now, I need a LRECL=80 and RECFM=FB.

Re: Can we copy a FBA file to FB file using a JCL?

Posted: Fri May 22, 2015 3:22 pm
by nicc
Just do a COPY operation in your sort product, copying bytes 2 to 81 to the output.

Re: Can we copy a FBA file to FB file using a JCL?

Posted: Tue May 26, 2015 1:58 pm
by Munnalal
Hi,

I have used this JCL:

Code: Select all

//STEP01     EXEC PGM=SORT 
//SORTIN   DD DSN=MY.FILE,...FBA 81 
//SORTOUT  DD DSN=OUT.FILE,RECFM=FB ... FB=80
//SYSOUT   DD SYSOUT=* 
//SYSIN    DD * 
  OPTION COPY 
  OUTREC FIELDS=(1:2,81)
 /*
//*

Re: Can we copy a FBA file to FB file using a JCL?

Posted: Tue May 26, 2015 2:02 pm
by zprogrammer
Thanks for sharing the solution

Re: Can we copy a FBA file to FB file using a JCL?

Posted: Tue May 26, 2015 3:35 pm
by William Collins

Code: Select all

//DROPBYTE     EXEC PGM=SORT
//SORTIN   DD DSN=MY.FILE,...FBA 81
//SORTOUT  DD DSN=OUT.FILE,RECFM=FB and don't specify LRECL.
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INREC BUILD=(2,80)

OUTREC holds no particular power over INREC in this case. FIELDS is "overloaded", BUILD is not, they are synonymous, so use of BUILD for new code is clearer.

You used starting column of 1:. This is the default for a BUILD (so also for FIELDS) so is unnecessary.

You used a length of 81, although the length of your data is 80. You got away with this (at some point you may get a S0C4 out-of-the-blue) because you specified an LRECL in the JCL. If you don't use an LRECL with DISP=NEW, SORT will supply the correct (from your control cards) LRECL automatically.