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

INREC - OVERLAY functions


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

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Fri Oct 21, 2011 7:59 am
Reply with quote

Hi,

I have a file as below

Code:
REPORT: ACCEPTABLE ERRORS FOUND     
----+----1----+----2----+----3----+-
RECORD       STATUS     ACCEPTABLE?
AAA                     ERROR       
BBB          COMPLETE   ACCEPTABLE 


Is it possible to change the header as below when the status is spaces?

Code:
REPORT: ERRORS FOUND     
----+----1----+----2----+----3----+-
RECORD       STATUS     ACCEPTABLE?
AAA                     ERROR       
BBB          COMPLETE   ACCEPTABLE 


I tried using the INREC OVERLAY as shown below but didn't work as expected.
Code:
SORT FIELDS=COPY                                   
INREC IFTHEN=(WHEN=(14,10,CH,EQ,C'            '),   
             OVERLAY=(9:C'ERRORS FOUND'))

Can someone please suggest me on this?
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 Oct 21, 2011 2:39 pm
Reply with quote

I should think that by the time you meet your condition the heading has already gone, so you are just blatting the current report line as you asked it to.

If you have two types of errors, acceptable and not, why don't you do two reports? Otherwise if you get a mix like in your example you'll have the wrong heading for one, or the other, set of data.

If you exclude the headings and any blank lines and split the remaining data into error/acceptable and then generate two reports, will that give you what you want?
Back to top
View user's profile Send private message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Fri Oct 21, 2011 6:54 pm
Reply with quote

When I tried using the sort
Code:
SORT FIELDS=COPY                                   
INREC IFTHEN=(WHEN=(14,10,CH,EQ,C'            '),   
             OVERLAY=(9:C'ERRORS FOUND'))

I got the output as
Code:
REPORT: ACCEPTABLE ERRORS FOUND     
----+----1----+----2----+----3----+-
RECORD       STATUS     ACCEPTABLE?
AAA     ERRORS FOUND    ERROR       
BBB          COMPLETE   ACCEPTABLE 

But what I'm look for is the "ACCEPTABLE ERRORS FOUND" which is in the line next to 'REPORT: ' should be replaced by "ERRORS FOUND". The file is FB and LRECL is 80.
Code:
REPORT: ERRORS FOUND               
----+----1----+----2----+----3----+-
RECORD       STATUS     ACCEPTABLE?
AAA                     ERROR       
BBB          COMPLETE   ACCEPTABLE 
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 Oct 21, 2011 7:18 pm
Reply with quote

Bhargav_1058,

As has been mentioned, twice, the heading that you want to change has already been read and written to the output file by the time your detail line arrives and you do the test.

You seem to have a report with two types of errors, Acceptable and Not.

Do you want both types of error in the same report? If so, decide on a heading for the report.

If you don't want to mix the two types of error on the same report, split into two reports each with a correct heading.

Best place to do it, either way, is where the report was created originally. If you are stuck having to take an existing report, then say exactly what you want (mix of data? one heading only, or one per page?) Etc.

Once you explain your requirement exactly, you'll probably get something useful.
Back to top
View user's profile Send private message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Fri Oct 21, 2011 7:40 pm
Reply with quote

Hi Bill,

I had to use the existing report, which will have both the errors acceptable or not. I want to know, if it is possible to change the REPORT line to 'ACCEPTABLE ERRORS FOUND' / 'ERRORS FOUND' based on the status of the record.

If either is not possible then I have to think of making some changes in the way existing report is produced.

My Apologies for making this mess!!
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 Oct 21, 2011 8:12 pm
Reply with quote

My thought is, you are going to end up with a report with a mixture of headings, and pages with a mixture of data of different statuses.

If you want it this way, it is possible with SORT. The experts will be in later, but they are on West Coast time. You need to get your requirement stated as clearly as possible. If this is the full thing, OK, but it is going to look a mess (my opinion).

Your heading can be used to define a "group" of records (from the heading to the next heading/eof). While processing the group you can check for your status. If you have blank lines, you might have some troubles looking for blanks for status, another reason I suggested going for "ERROR". If you find there is an ERROR set a status to say so. When processing the group, test the status and set overlay the heading if it says so.

Actual details I'll have to leave you to search the DFSORT forum for/consult the manual, but it certainly can be done.

As I say, get your requirement as clear as spring-water and you'll probably have a neat solution by tommorow morning.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Oct 21, 2011 11:59 pm
Reply with quote

Bhargav_1058,
See if below helps...

I am assuming your input is 80/FB.

Code:
//STEP0001     EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                         
//SORTJNF1 DD *                                                 
REPORT: ACCEPTABLE ERRORS FOUND                                 
RECORD       STATUS     ACCEPTABLE?                             
AAA                     ERROR                                   
CCC                     ERROR                                   
BBB          COMPLETE   ACCEPTABLE                             
//SORTJNF2 DD *                                                 
REPORT: ACCEPTABLE ERRORS FOUND                                 
RECORD       STATUS     ACCEPTABLE?                             
AAA                     ERROR                                   
CCC                     ERROR                                   
BBB          COMPLETE   ACCEPTABLE                             
//SORTOUT  DD  SYSOUT=*                                         
//SYSIN    DD *                                                 
  JOINKEYS FILES=F1,FIELDS=(81,8,A)                             
  JOINKEYS FILES=F2,FIELDS=(81,8,A)                             
  JOIN UNPAIRED,F1                                             
  REFORMAT FIELDS=(F1:1,80,?)                                   
  INREC IFTHEN=(WHEN=(81,1,CH,EQ,C'B'),                         
                OVERLAY=(81:C'ERRORS FOUND           ')),       
        IFTHEN=(WHEN=NONE,                                     
                OVERLAY=(81:C'ACCEPTABLE ERRORS FOUND'))       
  OPTION COPY                                                   
  OUTFIL HEADER1=(C'REPORT: ',81,23,80:X),BUILD=(1,80)         
/*                                                             
//JNF1CNTL DD *                                                 
 OMIT COND=(1,7,CH,EQ,C'REPORT:')                               
 INREC OVERLAY=(81:SEQNUM,8,ZD)                                 
/*                                                             
//JNF2CNTL DD *                                                 
 INCLUDE COND=(14,10,CH,EQ,C' ')                               
 INREC OVERLAY=(81:C'00000001')                                 
 SUM FIELDS=NONE                                               
/*                                                             

OUTPUT
Code:
REPORT: ERRORS FOUND               
RECORD       STATUS     ACCEPTABLE?
AAA                     ERROR       
CCC                     ERROR       
BBB          COMPLETE   ACCEPTABLE 


With all 3 records as COMPLETE it will get you below output
Code:
REPORT: ACCEPTABLE ERRORS FOUND   
RECORD       STATUS     ACCEPTABLE?
AAA          COMPLETE   ERROR     
CCC          COMPLETE   ERROR     
BBB          COMPLETE   ACCEPTABLE


Thanks,
Back to top
View user's profile Send private message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Sat Oct 22, 2011 2:13 am
Reply with quote

Hi Sqlcode1,

This is exactly what I'm looking for...

Though I have worked around & achieved this with an alternate solution.

1). Search for 'ERROR FOUND' in input file using ISRSUPC
2). If found replace the the 'ACCEPTABLE ERRORS FOUND' with 'ERRORS FOUND'. using the IFTHEN & WHEN & OVERLAY as below.

Code:

  SORT FIELDS=COPY                                   
  INREC IFTHEN=(WHEN=(9,31,CH,EQ,C'ACCEPTABLE ERRORS FOUND'), 
     OVERLAY=(9:C'ERRORS FOUND                             '))


Thaks for everyone's help!!
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 Help, trying to use OVERLAY to get a ... DFSORT/ICETOOL 3
No new posts INREC PARSE used to sort a CSV file DFSORT/ICETOOL 2
No new posts SQLCODE = -122 while using the scalar... DB2 4
No new posts DSNTIAUL and DB2 Scalar Functions DB2 17
No new posts Trying to use sort to do two function... DFSORT/ICETOOL 14
Search our Forums:

Back to Top