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
 

 

One tricky COBOL Interview question

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
bcmohanty

New User


Joined: 17 May 2006
Posts: 17

PostPosted: Fri May 19, 2006 2:13 pm    Post subject: One tricky COBOL Interview question
Reply with quote

Another Scenario mentioned below.
I have one output report file.
First 3 lines are headings
4th line is as ?Status: ------------------? (Possible values are ?Success, Failure and Success with Exception)
From 5th line onwards populated with data.
The 4th line status value will be populated once all the data starting from the 5th line will be processed. If all are processed successfully, the status is ?success?, if its failed then value is ?failure? and if some warning, then the status value is ?success with exception?
Since we write each record sequentially, the 4th record populates first then other data records, but the value of the 4th record depends upon all of the subsequent records. The file should not open twice in the Cobol program.
Back to top
View user's profile Send private message

Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Fri May 19, 2006 4:40 pm    Post subject:
Reply with quote

Hi

While you process the data write the processed data into a temporary data file. Once the process is over print the 'Status' in report. Then print the details from the temporary data file you have created.

Aji Cherian
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun May 21, 2006 10:44 am    Post subject:
Reply with quote

This might be a little kludgey, but it will work,

Create the report as 3 files: file1 contains the 1st 3 lines, file2 contains the 5th thru EOF, the 3rd contains line 4 and ic created after all other lines in the report.
The next step (IEBGENR or SORT or some such) copies the 3 files in 1-3-2 concatenation order to SYSOUT.

You could also print the recs from an internal table, but that can be problematic with larger reports.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm


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