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

Convert display statements to file output


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gehang

New User


Joined: 10 Dec 2010
Posts: 10
Location: Chicago

PostPosted: Tue Jan 10, 2012 10:01 pm
Reply with quote

I'm working on converting a large program that has lots of display statements. This program has large sections of them that they now want to send to an output file.

So I have blocks such as:
Code:

     display ' We hit some variable so braching the program'.
     display ' Starting processing at the start of a new file'.
     display ' because we hit an error at some record'.
     display ' and a bunch of other random text explinations'.
     display ' usually these are 5 - 15 line blocks'.
     display ' and there is probable close to 30 of them'.


Instead of spending two days manually changing all of them to:

Code:

     move ' We hit some variable so braching the program'
     to tmp.
     write output-record from tmp.
     move ' Starting processing at the start of a new file'
     to tmp.
     write output-record from tmp.
     move ' because we hit an error at some record'
     to tmp.
     write output-record from tmp.
     move ' and a bunch of other random text explinations'
     to tmp.
     write output-record from tmp.
     move ' usually these are 5 - 15 line blocks'
     to tmp.
     write output-record from tmp.
     move ' and there is probable close to 30 of them'
     to tmp.
     write output-record from tmp.


Is there some trick or tips for doing tedious tasks like this?
Back to top
View user's profile Send private message
gehang

New User


Joined: 10 Dec 2010
Posts: 10
Location: Chicago

PostPosted: Tue Jan 10, 2012 10:05 pm
Reply with quote

FYI, I know I can use "c all 'display' 'move'" then 'cc' the write lines and paste them over and over after each display line.

I was just wondering if anyone had any other suggestions.

If there was a "paste after all matching lines" command that would be awesome. Then I could copy the 'to tmp. write output-record from tmp.' lines and run a 'insert copied lines after each display line' command.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Tue Jan 10, 2012 10:07 pm
Reply with quote

something like :

DISPLAY txt UPON SYSOUT

?
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Jan 10, 2012 10:32 pm
Reply with quote

Yes if I understand your requirement map sysout to a dataset instead writing to spool
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: Wed Jan 11, 2012 4:37 am
Reply with quote

If you want to change the code to a move followed by a write, you could look at a little editor macro.

The shorter way has already been suggested, which is to change the //SYSOUT DD to have a dataset instead of SYSOUT=.

If you want to take the latter route, look at the OUTDD compiler option, where you can specify a different DDNAME for the default output from DISPLAY statements. This will remove the possibility of runtime diagnostic messages getting into your dataset of DISPLAY output.

If you want to take the former route, do some research (these forums, google, manuals) and see what you can make of things. Let us know in a new topic in the appropriate forum if you have any problems.
Back to top
View user's profile Send private message
gehang

New User


Joined: 10 Dec 2010
Posts: 10
Location: Chicago

PostPosted: Wed Jan 11, 2012 5:08 pm
Reply with quote

Thank you everyone for the much appreciated advice. I'm going to look into using edit macos. I'll update if I get a chance later today.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Wed Jan 11, 2012 7:19 pm
Reply with quote

Or use SDSF in batch as another step in the job executing the above program - and write the SYSOUT to a dataset. As an alternative IDCAMS or IEBGENER can also be used. Something like this should suffice, if SYSOUT and dataset both are needed:
Code:
//STEP001 EXEC PGM=YOURPGM
//SYSOUT   DD  DSN=SYSOUT.ON.FILE,
//         DISP=(NEW,CATLG,DELETE),
//         UNIT=TEST,SPACE=(TRK,(2,1),RLSE),
//         DCB=(LRECL=080,BLKSIZE=0,RECFM=FB)
//*
//STEP002 EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSFILE  DD  DSN=YOUR.SYSOUT.ON.FILE,DISP=OLD
//SYSOUT   DD  SYSOUT=*,DCB=(LRECL=080,BLKSIZE=0,RECFM=FB)
//SYSIN    DD  *
    REPRO INFILE(SYSFILE) OUTFILE(SYSOUT)
//*
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Thu Jan 12, 2012 5:42 pm
Reply with quote

@ gehang !

As i worked on an reengineering projekt, we had to redirect all WTO's in assembler and all DISPLAY's in cobol.

The easiest way was to write a MACRO for that. So we build a WTOLST (Write_To_List) and a DISPLLST (Display_To-List) Macro.

So a whole bunch of programms could be managed via a global-change at one strike.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top