Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SUM Formatted ZD integers and Display in Last Row

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sakreg

New User


Joined: 25 May 2006
Posts: 7

PostPosted: Thu Aug 02, 2007 4:42 pm    Post subject: SUM Formatted ZD integers and Display in Last Row
Reply with quote

I am using a CTRL card like below to format an Input File. I need to include a SUM statement that would sum all the 'ZD' integers. This SUMMED value should be shown at the last row of the output file using the same EDIT format.

For E.G., all values in the range between 70,17 (70,86 are the positions) should be summed and displayed in the last row with similar EDIT format at the same position (between 70,86).

Code:
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
       OUTREC FIELDS=(1,6,C';',7,9,C';',16,3,C';',19,2,C';',21,6,C';', 
            27,2,C';',29,4,C';',33,4,C';',37,10,C';',47,2,C';',         
            49,4,C';',53,4,C';',57,10,C';',67,3,C';',                   
            70,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
            87,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           104,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           121,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           138,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           155,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           172,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           189,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           206,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           223,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           240,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           257,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           274,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           291,17,ZD,EDIT=(III,III,III,III,IIT.TT))     



I want to retain the file WITH and WITHOUT summed value. The CONTROL cards will create a file with RECFM=FB and LRECL=404, another step should take this as an input and create an output with the summed vale at the last row with the same EDIT format at similar positions

Please advise.
Back to top
View user's profile Send private message

sakreg

New User


Joined: 25 May 2006
Posts: 7

PostPosted: Thu Aug 02, 2007 5:02 pm    Post subject: Re: SUM Formatted ZD integers and Display in Last Row
Reply with quote

Hope the below files would help


Input File is the Raw File

First Output File is after applying the CONTROL cards as in my previous post.


Second Output file is What is EXPECTED

Sample Files

Input File

Code:
7----+----8----+-
*****************
00000000003504771
00000000003504771
00000000018779900
00000000018779900
00000000024179900
00000000024179900
00000000011527945
00000000011527945
00000000014784006
00000000014784006
00000000006375000
00000000006375000
00000000009556000
00000000008051800
00000000001504200

First Output File

Code:
--+----9----+----0----+-
******************** Top
;             35,047.71;
;             35,047.71;
;            187,799.00;
;            187,799.00;
;            241,799.00;
;            241,799.00;
;            115,279.45;
;            115,279.45;
;            147,840.06;
;            147,840.06;
;             63,750.00;
;             63,750.00;
;             95,560.00;
;             80,518.00;
;             15,042.00;


Second Output File - EXPECTED

Code:
--+----9----+----0----+-
******************** Top
;             35,047.71;
;             35,047.71;
;            187,799.00;
;            187,799.00;
;            241,799.00;
;            241,799.00;
;            115,279.45;
;            115,279.45;
;            147,840.06;
;            147,840.06;
;             63,750.00;
;             63,750.00;
;             95,560.00;
;             80,518.00;
;             15,042.00;
          $177,415,0.44
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Aug 02, 2007 8:28 pm    Post subject:
Reply with quote

Quote:
I need to include a SUM statement that would sum all the 'ZD' integers


It's not entirely clear what you want for output, but SUM is not the right approach for this.

Instead, you can use DFSORT statements something like this:

Code:

    SORT FIELDS=COPY
    OUTFIL REMOVECC,
      OUTREC=(...),
      TRAILER1=(c:TOT=(70,17,ZD,EDIT=($III,III,III,III,IIT.TT)),X,
                       TOT=(87,17,ZD,EDIT=($III,III,III,III,IIT.TT)),X,
           ...)


where c is the output position where the totals start.

If you want two output files, one without the total and the other with the total, you can use two OUTFIL statements: one with FNAMES=OUT1 and no TRAILER1, and the other with FNAMES=OUT2 and TRAILER1.

You'll need to play around with the OUTREC and TRAILER1 operands to get the report to look the way you want it.
Back to top
View user's profile Send private message
sakreg

New User


Joined: 25 May 2006
Posts: 7

PostPosted: Fri Aug 03, 2007 12:17 am    Post subject:
Reply with quote

Frank Yaeger,

Thank you for your time.

Second Output File - EXPECTED as shown in my previous post is what I expect which is formatted and the total is displayed on the last line

I am using the below control cards based on your post

Code:
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
       OUTREC FIELDS=(1,6,C';',7,9,C';',16,3,C';',19,2,C';',21,6,C';', 
            27,2,C';',29,4,C';',33,4,C';',37,10,C';',47,2,C';',         
            49,4,C';',53,4,C';',57,10,C';',67,3,C';',                   
            70,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
            87,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           104,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           121,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           138,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           155,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           172,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           189,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           206,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           223,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           240,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           257,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           274,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',               
           291,17,ZD,EDIT=(III,III,III,III,IIT.TT)),               
       TRAILER1=(2:TOT=(70,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(87,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(87,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(104,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(121,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(138,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(155,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(172,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(189,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(206,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(223,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(240,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(257,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(274,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(291,17,ZD,EDIT=(III,III,III,III,IIT.TT)))


I am getting

Code:
ICE005A 0 STATEMENT DEFINER ERROR                                               
                             TOT=(87,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,   


Anything Wrong? What X stands for?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Aug 03, 2007 12:55 am    Post subject:
Reply with quote

I showed:

Code:

   OUTFIL REMOVECC,
      OUTREC=(...),
      TRAILER1=(...)


You have:

Code:

    OUTREC FIELDS=(...),
       TRAILER1=(....)


Do those look the same to you? I have an OUTFIL statement with REMOVECC, OUTREC and TRAILER1 parameters which is valid. You have an OUTREC statement with a TRAILER1 parameter which is invalid.

X is one blank.

Here's the correct syntax per my previous post:

Code:

  SORT FIELDS=COPY
  OUTFIL REMOVECC,
    OUTREC=(1,6,C';',7,9,C';',16,3,C';',19,2,C';',21,6,C';',
            27,2,C';',29,4,C';',33,4,C';',37,10,C';',47,2,C';',
            49,4,C';',53,4,C';',57,10,C';',67,3,C';',
            70,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
            87,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           104,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           121,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           138,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           155,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           172,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           189,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           206,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           223,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           240,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           257,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           274,17,ZD,EDIT=(III,III,III,III,IIT.TT),C';',
           291,17,ZD,EDIT=(III,III,III,III,IIT.TT)),
       TRAILER1=(2:TOT=(70,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(87,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(87,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(104,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(121,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(138,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(155,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(172,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(189,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(206,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(223,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(240,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(257,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(274,17,ZD,EDIT=(III,III,III,III,IIT.TT)),X,
                   TOT=(291,17,ZD,EDIT=(III,III,III,III,IIT.TT)))
Back to top
View user's profile Send private message
sakreg

New User


Joined: 25 May 2006
Posts: 7

PostPosted: Fri Aug 03, 2007 1:23 pm    Post subject:
Reply with quote

Oops Sorry for that.

Somehow it got slipped from my eyes

Thank You very much
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts display the sign only if the value is... useit DFSORT/ICETOOL 3 Wed Oct 04, 2017 5:53 pm
No new posts Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts Display upon console bipinpeter COBOL Programming 1 Thu Jun 22, 2017 12:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us