Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SUM FIELDS Giving S0C7

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Tue Jul 01, 2014 4:01 pm    Post subject: SUM FIELDS Giving S0C7
Reply with quote

Hi All,

I have a file which is of 958 bytes. The file has junk values in some fields, due to which the SUM fileds done on these fields was giving S0C7. So I used INREC to overlay these fields with 0 (these fields are PD). But still the job is failing with S0C7.

Code:
INREC IFTHEN=(WHEN=(1,3,ZD,EQ,999),           
              OVERLAY=(540:+0,TO=PD,LENGTH=9, 
                       039:+0,TO=PD,LENGTH=9, 
                       266:+0,TO=ZD,LENGTH=2, 
                       4:19C'9'))             
                                                   
OUTFIL FNAMES=SORTOUT,                             
     INCLUDE=(4,19,CH,NE,C'                   ',AND,
              4,19,CH,NE,C'0000000000000000000',AND,
              232,2,ZD,NE,87,AND,                   
              232,2,ZD,NE,88,AND,                   
              232,2,ZD,NE,89,AND,                   
             (1,3,ZD,EQ,999,OR,                     
              36,1,CH,EQ,C'C',OR,                   
              36,1,CH,EQ,C'D',OR,                   
              36,1,ZD,EQ,1,OR,                     
              36,1,ZD,EQ,2),AND,                   
              266,2,ZD,EQ,0)                   
                                                   
SORT FIELDS=(1,3,ZD,A,                 
             4,19,CH,A,                 
             36,1,CH,A,                 
             32,4,PD,A,                 
             37,2,PD,A,                 
             61,4,PD,A,                 
             80,3,PD,A,                 
                                       
             220,3,PD,A,               
             288,1,CH,A,               
             484,2,CH,A,               
             493,9,PD,A,               
             634,1,ZD,A)               
*                                       
 SUM FIELDS=(39,9,PD,                   
             540,9,PD)                 


If I split this into 2 different Steps, first step contains the INREC and INCLUDE and the second step contains the SORT and SUM fields the job is running fine with expected output.

I also used ICETOOL to verify the output after INREC and there is no discrepancies shown and the job runs fine. Below is the ICETOOL Sort Card.

Code:
 COPY FROM(SORTIN) TO(T1) USING(CTL1)    -> CTL1 contains the INREC and INCLUDE statments
 VERIFY FROM(T1) ON(540,9,PD)                             -> To verfiy if the fields used for SUM fields are having proper values.
 VERIFY FROM(T1) ON(039,9,PD)                             -> To verfiy if the fields used for SUM fields are having proper values.   
 SORT FROM(T1) TO(SORTOUT) USING(CTL2)          -> Contains the SORT and SUM fields statement.             


Could you please help me on what is wrong with the first SORT Card. Do I need to use 2 steps to achieve the purpose?

Note: - I cannot omit the records which are having junk values.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Tue Jul 01, 2014 6:30 pm    Post subject: Reply to: SUM FIELDS Giving S0C7
Reply with quote

I can't see matching brackets on your INCLUDE=.

I think your problem is the things aren't working in the order you expect. Have you considered using INCLUDE/OMIT COND=, which operates before INREC? You are using INCLUDE= on OUTFIL, which is after INREC, SORT, SUM, OUTREC.

When you split into two steps, your INCLUDE was done before the SORT/SUM. With the single step it was done after the SORT/SUM.

So no, there is no reason to split things up. And no reason to read the file four times in ICETOOL.
Back to top
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Tue Jul 01, 2014 6:59 pm    Post subject:
Reply with quote

Hi Bill,

It was a typo. My code has an ending brackets in the INCLUDE.

I did try the INCLUDE COND before the INREC. But the problem is I need to overlay 19 '9' from position 4 in case if the 1st 3 positions are 999 (currently the field contains spaces). If I don't do this, the INCLUDE COND will actually skip the record (as shown below).

Code:
OUTFIL FNAMES=SORTOUT,                             
     INCLUDE=(4,19,CH,NE,C'                   ',AND,
              4,19,CH,NE,C'0000000000000000000',AND,


Thanks,
Indrajit
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Tue Jul 01, 2014 7:35 pm    Post subject: Reply to: SUM FIELDS Giving S0C7
Reply with quote

Can you frame the INCLUDE so that it also gets the records you are going to amend in the INREC?

If not, perhaps forget the SUM and look at OUTFIL reporting features. You'll need REMOVECC,NODETAIL and TRAILER2 with TOT for the fields you are currently SUMming.

Bear in mind that SUM will base on the first record being SUMmed (see discussion of EQUALS/NOEQUALS in the manual) and TRAILER2 on the last (bear in mind same discussion).

Code:
INCLUDE/OMIT COND=

INREC

SORT/MERGE

SUM

OUTREC

OUTFIL(s) with INCLUDE=/OMIT= (optional)


Remember that in whatever order you code them, this is the order they are going to be processed in. Trying to use INCLUDE=/OMIT= to modify SUM values will not work.
Back to top
View user's profile Send private message
Indrajit_57
Warnings : 1

New User


Joined: 27 Jun 2006
Posts: 60

PostPosted: Sat Jul 05, 2014 9:26 am    Post subject:
Reply with quote

Thanks Bill for your suggestion. I modfied the SORT to have INCLUDE before the INREC and used an OMIT in OUTFIL. The got the results as expected. Below is the SORT Card.

Code:
 INCLUDE COND=(4,19,CH,NE,C'0000000000000000000',AND,
               232,2,ZD,NE,87,AND,                 
               232,2,ZD,NE,88,AND,                 
               232,2,ZD,NE,89,AND,                 
              (1,3,ZD,EQ,999,OR,                   
               36,1,CH,EQ,C'C',OR,                 
               36,1,CH,EQ,C'D',OR,                 
               36,1,ZD,EQ,1,OR,                     
               36,1,ZD,EQ,2),AND,                   
               266,2,ZD,EQ,00)                   
*                                                                       
 INREC IFTHEN=(WHEN=(1,3,ZD,EQ,999),           
               OVERLAY=(540:+0,TO=PD,LENGTH=9, 
                        039:+0,TO=PD,LENGTH=9, 
                        266:+0,TO=ZD,LENGTH=2, 
                        4:19C'9'))             
*                                                                       
 SORT FIELDS=(1,3,ZD,A,                   
             4,19,CH,A,                   
             36,1,CH,A,                   
             32,4,PD,A,                   
             37,2,PD,A,                   
             61,4,PD,A,                   
             80,3,PD,A,                   
             288,1,CH,A,                   
             493,9,PD,A,                   
             634,1,ZD,A)                   
 SUM FIELDS=(39,9,PD,                     
            540,9,PD)                     
 OUTFIL FNAMES=SORTOUT,                                                 
      OMIT=(4,19,CH,EQ,C'                   ') 
*                                                                       
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Need Help to Define 36 Input Fields (... satish.ms10 CLIST & REXX 2 Sat May 07, 2016 3:08 pm
No new posts FileAid to compare(logical operations... anand1204 Compuware & Other Tools 3 Wed Apr 06, 2016 2:55 am
No new posts Fields in File-Aid Browse menu screen boyti ko Compuware & Other Tools 5 Mon Apr 04, 2016 4:51 pm
No new posts SUM FIELDS=NONE with INCLUDE kranthikumarb DFSORT/ICETOOL 17 Mon Dec 28, 2015 12:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us