|
View previous topic :: View next topic
|
| Author |
Message |
Bhargav_1058
New User
.jpg)
Joined: 13 Dec 2008 Posts: 53 Location: New York
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Bhargav_1058
New User
.jpg)
Joined: 13 Dec 2008 Posts: 53 Location: New York
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Bhargav_1058
New User
.jpg)
Joined: 13 Dec 2008 Posts: 53 Location: New York
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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 |
|
 |
Bhargav_1058
New User
.jpg)
Joined: 13 Dec 2008 Posts: 53 Location: New York
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|