Page 1 of 1

Using INREC BUILD and overlay

PostPosted: Fri Oct 31, 2008 9:57 pm
by shilpakhaire
I have a file with an alphanumeric field. I want the sum of this field. I am using this..but gives me error....Plz correct me...

//STEP001  EXEC PGM=ICEMAN                                           
//*                                                                 
//SYSPRINT  DD SYSOUT=*                                             
//SYSOUT    DD SYSOUT=*                                             
//SYSDBOUT  DD SYSOUT=I                                             
//SYSUDUMP  DD SYSOUT=I                                             
//*                                                                 
//SORTIN   DD DSN=DW3T.NDM.SL60.FIDELITY.MSTR.ODS.NBR096,DISP=SHR   
//SORTOUT  DD DSN=DW3T.NDM.SL60.FIDELITY.MSTR.ODS.NBR096.SM,DISP=SHR
//SYSIN    DD *                                                     
  OPTION ZDPRINT                                                     
  SORT FIELDS=(1,13,CH,A)                                             
  INREC BUILD=(1,12,SFF,TO=ZD,LENGTH=12)                             
  SUM FIELDS=(75,12,ZD)                                               
  OUTREC OVERLAY=(1:1,12,ZD,M12,LENGTH=12)                           
/*                                                                   


Thanks,
Shilpa

Re: Very urgent - Using INREC BUILD and overlay

PostPosted: Fri Oct 31, 2008 10:34 pm
by Frank Yaeger
If it's so urgent, you should have supplied sufficient information on what you're trying to do so I could show you how to do it. But you didn't, so all I can do is tell you what you did wrong.

Here's what you're doing and the problems I see:
- INREC reformats an SFF field to a ZD field in positions 1-12. The reformatted record is 12 bytes long.
- SORT tries to sort on 1,13,ZD - but the reformatted record is only 12 bytes long so you can't sort on 13 bytes. I don't know what you're trying to SORT on, but whatever it is, INREC is changing it before you sort on it.
- SUM tries to sum on 75,12,ZD - but the reformatted record is only 12 bytes long so you can't sort on position 75. You probably want to SUM on 1,12,ZD.

If you want further help on this, you need to show me an example of your input records and what you expect for output, and explain what you're trying to do. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields.

Re: Very urgent - Using INREC BUILD and overlay

PostPosted: Fri Oct 31, 2008 10:38 pm
by shilpakhaire
Sorry..I have an inpiut file of 3229 length. I want to sum an alphanumeric field in this file which is at position 75 and has length 12.
I dont wnat to sort anything so i guess sort fields=copy should work.

Re: Very urgent - Using INREC BUILD and overlay

PostPosted: Fri Oct 31, 2008 11:08 pm
by Frank Yaeger
Do you want the summed field to start at position 75, or at position 1? I asked you to show me an example of your input records and what you expect for output for a reason. Please do so.

Re: Very urgent - Using INREC BUILD and overlay

PostPosted: Fri Oct 31, 2008 11:42 pm
by shilpakhaire
Input file is as i described earlier. I just want a summation of the input filed at 75'th position which is 12 bytes long.
Output can be another file with just one record 12 bytes long. But his input field has decimals too. I cud xtract the field to another file, but the decimals are not coming.
e.e
8093.12
is getting xtracted as 809312 .

I want it as 8093.12 only.

Re: Very urgent - Using INREC BUILD and overlay

PostPosted: Sat Nov 01, 2008 1:03 am
by Frank Yaeger
Sounds like you just want a total of the 75,12,SFF field in one record in the output. If so, you can use this DFSORT job. Note that you CANNOT use the same data set for input and output.

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN   DD DSN=...  input file
//SORTOUT  DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    TRAILER1=(TOT=(75,12,SFF,EDIT=(IIIIIIIIT.TT)))
/*


For example, if the field at 75,12 contained these values:

     8093.12
     5023.13
      -23.52


SORTOUT would contain one record with this value:

    13092.73   


I don't know why you couldn't show me an example like that.

Re: Very urgent - Using INREC BUILD and overlay

PostPosted: Sat Nov 01, 2008 10:05 am
by shilpakhaire
Thanks a lot Frank! You are a genius!
Saved me the tedious task of writing a program!

Re: Very urgent - Using INREC BUILD and overlay

PostPosted: Sat Nov 01, 2008 9:38 pm
by Frank Yaeger
You're welcome.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/servers/storage/supp ... tmpub.html

It will save you writing lots of programs. ;)