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

One tricky COBOL Interview question


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top