Page 1 of 1

Production of Comma Separated Variables

PostPosted: Fri Aug 08, 2008 4:16 pm
by jishnurb
Hi,
I have a Physical sequential file which contains records.
Say like this
SAM
22
PAT
like this, I would like to write them in to a file in Comma seperated format.
Thanks
jishnurb

Re: Production of Comma Separated Variables

PostPosted: Fri Aug 08, 2008 8:31 pm
by Frank Yaeger
It's not clear what you want to do here. Do you want to create one output record with the fields from all of the input records separated by commas? If so, what's the maximum number of input records? Or do you want to do something else?

You need to explain what you want to do more clearly. Give the "rules" for getting from input to output. Show the expected output. Give the RECFM and LRECL of the input file and the expected output file.

Re: Production of Comma Separated Variables

PostPosted: Tue Aug 12, 2008 11:31 am
by jishnurb
I have an output physical sequential file of LRECL 80 and block size 800.The records are written in this file in this way

jishnurb
22
PAT

Now I a process which treats above flatfile as input file.The out file must be having the same features of input file(RECFM and LRECL). But the output file must look like this

jishnurb,
22,
PAT

They are comma separated.

Re: Production of Comma Separated Variables

PostPosted: Tue Aug 12, 2008 11:37 am
by jishnurb
there is no restriction to the maximum number of input records

Re: Production of Comma Separated Variables

PostPosted: Tue Aug 12, 2008 9:32 pm
by Frank Yaeger
Here's a DFSORT job that will do what you asked for:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,ZD)
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    TRAILER1=('LASTREC,+',COUNT=(M11,LENGTH=8))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=(81,8,ZD,NE,LASTREC),
      OVERLAY=(1:1,80,JFY=(SHIFT=LEFT,TRAIL=C',')))
/*