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

OUTREC on OUTFIL error


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rocky_balboa

New User


Joined: 24 Mar 2010
Posts: 61
Location: Cape of Good Hope

PostPosted: Thu Aug 27, 2015 10:26 am
Reply with quote

Hi ,

I am trying to code an OUTREC on OUTFIL but unable to. I am creating a SORT card which will validate the header and trailer and depending on validation failure OUTREC into the HEADER error file or the TRAILER error file accordingly.

Code:

 OPTION COPY                                                   
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(1001:SEQNUM,11,ZD)),       
       IFTHEN=(WHEN=(1,1,ZD,EQ,9),                           
               OVERLAY=(1001:1001,11,ZD,SUB,+2,M10,LENGTH=11))
 OUTFIL FNAMES=HEADER,INCLUDE=((1001,11,ZD,EQ,1),AND,         
                              ((1,1,CH,NE,C'0'),OR,           
                              ((23,8,CH,LT,DATE1-2),OR,       
                               (23,8,CH,GT,DATE1+2)))), <-this comma-       
 OUTREC IFTHEN=(WHEN=(1,1,CH,NE,C'0'),                       
        OVERLAY=(1:C'HEADER RECORD TYPE IS NOT 0',53X)),     
        IFTHEN=(WHEN=((23,8,CH,LT,DATE1-2),OR,               
                      (23,8,CH,GT,DATE1+2)),                 
        OVERLAY=(1:C'HEADER DATE IS INVALID*****',53X))       
 OUTFIL FNAMES=TRAILER,INCLUDE=((1,1,ZD,EQ,9),AND,           
                              (3,11,ZD,EQ,1001,11,ZD),AND,   
                              (1001,11,ZD,GT,0))             
                             

When I put a comma as indicated it says me a syntax error and when I remove the comma it works fine but the problem in that case is that I can code only one OUTREC.

How do I code so that I can have 2 files in the o/p where in I can code the conditions for header and trailer error file separately.

Regards
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: Thu Aug 27, 2015 11:40 am
Reply with quote

Firstly, read this.

Is it any clearer?

You've fallen into the unintended trap of thinking that just because OUTFIL has OUTREC, the OUTREC on OUTFIL must be the same as OUTREC.

If you want to use IFTHEN on OUTFIL, just use it. OUTREC on OUTIL means BUILD, so just use BUILD.

Code:
 OPTION COPY                                               
   
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(1001:SEQNUM,11,ZD)),       
       IFTHEN=(WHEN=(1,1,ZD,EQ,9),                           
               OVERLAY=(1001:1001,11,ZD,SUB,+2,M10,LENGTH=11))

 OUTFIL FNAMES=HEADER,INCLUDE=((1001,11,ZD,EQ,1),AND,         
                              ((1,1,CH,NE,C'0'),OR,           
                              ((23,8,CH,LT,DATE1-2),OR,       
                               (23,8,CH,GT,DATE1+2)))),       
        IFTHEN=(WHEN=(1,1,CH,NE,C'0'),                       
        OVERLAY=(1:C'HEADER RECORD TYPE IS NOT 0',53X)),     
        IFTHEN=(WHEN=((23,8,CH,LT,DATE1-2),OR,               
                      (23,8,CH,GT,DATE1+2)),                 
        OVERLAY=(1:C'HEADER DATE IS INVALID*****',53X))       

 OUTFIL FNAMES=TRAILER,INCLUDE=((1,1,ZD,EQ,9),AND,           
                              (3,11,ZD,EQ,1001,11,ZD),AND,   
                              (1001,11,ZD,GT,0)) 


And, does this bit look simpler?

Code:
 OUTFIL FNAMES=HEADER,
        INCLUDE=(1001,11,ZD,EQ,1,
                AND,         
                 (1,1,CH,NE,C'0',
                 OR,           
                  23,8,CH,LT,DATE1-2,
                 OR,       
                  23,8,CH,GT,DATE1+2)),


Some people "like" the ANDs and ORs at the "end" of a line, some at the beginning. If they are on a line of their own they are at both the end and the beginning. Use indentation to express your intent (easier then for someone to read (and note if it is wrong). Don't use brackets where not needed (SORT "parses" its control cards by knowing what may come next, the individual conditional elements of INCLUDE/OMIT COND/= do not need brackets).
Back to top
View user's profile Send private message
rocky_balboa

New User


Joined: 24 Mar 2010
Posts: 61
Location: Cape of Good Hope

PostPosted: Fri Aug 28, 2015 11:24 am
Reply with quote

I am still not clear with restrictions on OUTREC on OUTFIL or under what circumstances it cannot be used.
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: Fri Aug 28, 2015 5:25 pm
Reply with quote

OUTREC, as in the statement OUTREC, like you tried to use it, can never be used on OUTFIL.

Never.

What is the OUTREC on OUTFIL? It is a parameter of OUTFIL. That is something entirely different from a statement.

The OUTREC parameter is part of OUTFIL.

The OUTREC statement, is a statement, like INREC and INCLUDE and SORT and MERGE and SUM and OUTFIL.

If you use BUILD on OUTFIL instead of OUTREC on OUTFIL, any confusion disappears.

If you want to be about to do on OUTFIL what you can do on OUTREC (or INREC) then it is easy. You just do it in the same way.

Code:
  INREC BUILD=...

  OUTREC BUILD=...

  OUTFIL BUILD=...


Especially instead of:

Code:
  INREC FIELDS=...

  OUTREC FIELDS=...

  OUTFIL OUTREC=...


On the OUTFIL OUTREC=, note the =. Note that the OUTREC statement doesn't have an =. That is because they are two entirely different things, which use the same letters of the alphabet in the same under but are otherwise unconnected. It is known as "overloading".

It is the "old" way of coding it, and it will be supported for ever (so that old code is not required to be changed).

I've already shown you what your code should look like. If there is still a problem, you're going to have to explain it clearly.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Aug 31, 2015 9:52 pm
Reply with quote

Little late to the party but hopefully DFSort processing flow might help you with understanding.

Thanks,
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts OUTFIL with SAVE option DFSORT/ICETOOL 7
Search our Forums:

Back to Top