IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SUM FIELDS Giving S0C7


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 01, 2014 6:30 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 01, 2014 7:35 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts S0C7 - Field getting overlayed COBOL Programming 2
No new posts CSQBGET - Call giving completion code... COBOL Programming 3
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts Converting unpacked fields to pack us... SYNCSORT 4
Search our Forums:

Back to Top