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
 

 

Reading a record after a blank line

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Navdeep Aggarwal

New User


Joined: 27 Jun 2011
Posts: 8
Location: India

PostPosted: Mon Aug 15, 2011 9:19 pm    Post subject: Reading a record after a blank line
Reply with quote

I am reading a report to get the required details and then making a new file of a relevant data from it. I am putting a condition as to if the input record(header) matches this criteria, then from there onwards my relevant data is there. but the problem is that, once i match the input record(header), there is a black line between the data and the header. So, i dont know how to get the record from the report.

Any Pointers....

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

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Aug 15, 2011 9:36 pm    Post subject: Reply to: Reading a record after a blank line
Reply with quote

When I have to strip out data from a report, first of all I get rid of all the "rubbish" which is nothing to do with the data. Blank line, read next. "END OF PAGE", read next, etc.

Then, after that, logic for the data itself.

However, always better to have a data file.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Aug 15, 2011 9:38 pm    Post subject:
Reply with quote

Your description is not very clear, I read it 3 times but I don't understand it. From the attached document, this is what I see there:
Code:
DATE    TIME        LOGONID   JOBNAME    CHANGER  CHANGE   CPU       USING
                                                                               
11.196 07/15 18.11       T0353DT   ACIN999Z   MAINTLID CHANGE   P36A           
11.196 07/15 18.11       T0374WH   ACIN999Z   MAINTLID CHANGE   P36A           
11.196 07/15 18.11       T0381TG   ACIN999Z   MAINTLID CHANGE   P36A           

So does this show input-structure or this is expected output? What exact problem do you have with "blank-line"? And what is "blank-line" in a file, assuming input is QSAM as you talk about report as input.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Mon Aug 15, 2011 9:57 pm    Post subject:
Reply with quote

Looks like a dataset with printer control characters in position 1.
Maybe you have a problem with that.
Back to top
View user's profile Send private message
Navdeep Aggarwal

New User


Joined: 27 Jun 2011
Posts: 8
Location: India

PostPosted: Mon Aug 15, 2011 10:13 pm    Post subject:
Reply with quote

Anuj- the layout which you have shown is the layout for my input-file (report). Because there is lot of irrelevant data in this report, I have put a condition as
IF INPUT- REC (X:Y) = CHANGER
THEN START PROCESSING.

Now you can see that after my condition got true, the next line is a "Blank Line", however i want to fetch the details like

11.196 07/15 18.11 T0353DT ACIN999Z MAINTLID CHANGE P36A

So my problem is as to how i should read it taking the in between blank line into consideration ???
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Mon Aug 15, 2011 10:40 pm    Post subject:
Reply with quote

Perhaps you could add the condition
Code:
if line not blank
    then process
? Just a wild thought.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Mon Aug 15, 2011 10:41 pm    Post subject:
Reply with quote

What is the DCB of your input file?
Back to top
View user's profile Send private message
Navdeep Aggarwal

New User


Joined: 27 Jun 2011
Posts: 8
Location: India

PostPosted: Mon Aug 15, 2011 10:46 pm    Post subject:
Reply with quote

Robert - The input file is actually a report and the DCB parameter is

DCB=(MODEL,RECFM=VB,BLKSIZE=3665)
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Mon Aug 15, 2011 11:19 pm    Post subject:
Reply with quote

Quote:
The input file is actually a report
This is completely and totally irrelevant -- stop mentioning it because it does not matter.

If the report is a physical file, as opposed to merely a temporary data set pased to another step of the same job, do an ISPF 3.4 on it and find out the ACTUAL DCB instead of what you think the DCB is, then post that.

Also, depending upon the data, there may not be an actual blank line -- reports often have carriage control, in which case the first byte being a zero would be translated WHEN PRINTED into a blank line -- but you would not see that blank line in the actual file.

Also, using variable length records for the report file could mean the blank line consists of an actual line with anywhere from 1 blank to who knows how many blanks (the maximum would depend upon the LRECL).

Which of these cases applies? Who knows -- you're not providing ANYTHING helpful.
Is your problem:
- that you THINK there is a blank line after the header? If so, have you tried to actually read the data?
- that you read the blank line and your program quits?
- that you read the blank line and your program abends?
- that you read past the blank line but the data you're looking for is not found?
- that you are not matching the header as you expected?
- something else entirely that you have not yet explained?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 16, 2011 12:06 am    Post subject:
Reply with quote

Hello,

Suggest you edit the "report file" and set HEX ON. Then copy/paste the first 5 records into a reply to the forum (use the Code tag). Use Preview to make sure your post appears like your screen display.

You seem to be unsure of just what you have and we have no idea. . .
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Aug 16, 2011 7:05 pm    Post subject:
Reply with quote

1. Answer what Robert has asked for.
2. Follow what Dick has suggested.
3.
Navdeep Aggarwal wrote:
the layout which you have shown is the layout for my input-file (report).
.
.
.
So my problem is as to how i should read it taking the in between blank line into consideration ???
Keeping in mind only data you show as your input to the COBOL program, it looks like in "data-part", after "report headings" first 6-bytes are date-in-julian-format. If yes, possibly define a layout for your input having first varible definition as PIC X(6) and the second variable will represent the rest of the report.
Code:
01 REPORT-INPUT
     05 NUM-CHECK-VAR       PIC X(6).
     05 REST-FO-THE-RPT     PIC X(lrecl-6).
READ input file into the above and check if the value in NUM-CHECK-VAR using NUMVAL, if it is numeric - write to output; if it's not READ.

Well, everything will change if your data changes - it's a suggestion about the data you show as input.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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