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
 

 

OUTREC on OUTFIL error

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: OUTREC on OUTFIL error
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Thu Aug 27, 2015 11:40 am    Post subject: Reply to: OUTREC on OUTFIL error
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    Post subject: Reply to: OUTREC on OUTFIL error
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Fri Aug 28, 2015 5:25 pm    Post subject: Reply to: OUTREC on OUTFIL error
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: 578
Location: USA

PostPosted: Mon Aug 31, 2015 9:52 pm    Post subject:
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    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 S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm
No new posts SORT- outrec ram_vizag DFSORT/ICETOOL 10 Tue Sep 27, 2016 12:50 am


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