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

Assembler Instruction to Display data in Spool


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Fri May 13, 2011 6:26 pm
Reply with quote

Hi,

I want to display some fields or data in spool for debugging purpose.

Can anyone tell me assembler instruction equivalent to 'DISPLAY' in COBOL which can be coded in Assembler to display data? Thanks

Regards,
Vinay
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8651
Location: Dubuque, Iowa, USA

PostPosted: Fri May 13, 2011 6:38 pm
Reply with quote

There is no equivalent statement in Assembler to COBOL's DISPLAY statement. You could write your own routine as a macro but you'll have to handle format conversions yourself.
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Fri May 13, 2011 6:50 pm
Reply with quote

But to write a Macro, what is it that we need to use to display the data in spool. Is it we need to use PUT instruction only?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri May 13, 2011 7:28 pm
Reply with quote

You could use a WTO, with ROUTCDE=(11), which writes to JESMSGLG.

But, check with site operations staff before you do this.

Bill
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8651
Location: Dubuque, Iowa, USA

PostPosted: Fri May 13, 2011 7:58 pm
Reply with quote

You would need to define a DCB in the program, open it, set up the print line, and PUT the data -- closing the file when through with it. Your JCL would have that DD name set to SYSOUT=* (or appropriate value for your site).
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Mon May 16, 2011 2:32 pm
Reply with quote

Yes, you could use WTO macro

The syntax should be:

Code:
DISMSG    WTO     TEXT=WTOAR,ROUTCDE=11


Add a halfword named WTOAR before the Area in storage you want to display. For example:

Code:

WTOAR  DC    H'40'
WRKAR  EQU   *
FLDA   DS    CL20
FLDB   DS    PL4
..... and so on

The halfword WTOAR is the length of bytes that will be displayed. Make sure its not too long( always < 80 bytes)

Routcde=11 will route your message to Jesysmsg in your spool.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Mon May 16, 2011 3:01 pm
Reply with quote

FWIW, I would use a snapdump of my working storage(s). Works as a charm.
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 17, 2011 11:04 am
Reply with quote

Hi Nihal,

I am facing an ABEND SD23 when I used below instructions to display in JESMSG

DISMSG WTO TEXT=MSG1,ROUTCDE=11
MSG1 DC CL5'VINAY'

However the Job went fine when I used

DISMSG WTO 'PROGRAM TESTPGM EXECUTING'

I want to display contents of a variable or Register. Can you please tell me how can I do that? Thanks
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Tue May 17, 2011 11:52 am
Reply with quote

You should use the EXECUTE and LIST form of WTO in this case.
See the following example :

www.longpelaexpertise.com.au/ezine/ReentrantBeginners.php
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 17, 2011 12:42 pm
Reply with quote

Hi Peter,

I used the same way it has been mentioned in the example you have mentioned. But I am getting SOC1 abend.

LA R3,MSG1
DISMSG WTO TEXT=(R3)
MSG1 DC AL2(L'MSG1TXT)
MSG1TXT DC C'PROGRAM TESTPGM EXECUTING'
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Tue May 17, 2011 1:07 pm
Reply with quote

Is MSG1 and MSG1TXT immediate after your WTO instruction? If thats the case no wonder your program abends. WTO might abnormally terminate with abend code X'D23' not with a 0C1.
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 17, 2011 1:18 pm
Reply with quote

Yes. MSG1 and MSG1TXT are immediate after the WTO instruction.

May I know the reason for ABEND if they are just after WTO instruction?

Do I need to write them at the end of the program?
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue May 17, 2011 1:37 pm
Reply with quote

Morning Sir !

If you only want to display some simple messages to simply track your programm flow, a simple WTO at several places would do.

WTO 'This is: Label-13'

...or more flexible:


MVC WTOMSG1+017(008),=C'Label-13'
...
...
WTOMSG1 WTO 'This is: xxxxxxxx'


WTO-Command uses 8 Bytes itsself. So the first Byte for a text-Char is
wto-label+8. In this example the Wto message is modified by a former MVC.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue May 17, 2011 1:39 pm
Reply with quote

@ vinayknj

Quick response to your last question.

Your wto was not followed by any instruction.
Your wto was followed by a define-constant.

So you got a illegal instruction
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Tue May 17, 2011 2:03 pm
Reply with quote

UmeySan wrote:
@ vinayknj

Quick response to your last question.

Your wto was not followed by any instruction.
Your wto was followed by a define-constant.

So you got a illegal instruction


Thanks for repeating my comment.
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 17, 2011 3:21 pm
Reply with quote

Hi Peter/Umeysan

Please let me know what is wrong with below instructions. I am getting SD23 Abend...

DISMSG4 WTO TEXT=OUTREC
OPEN (OUTFLE,(OUTPUT))
DISMSG2 WTO 'OPEN OUTPUT FILE SUCCESS'
PUT OUTFLE,OUTREC
DISMSG3 WTO 'WRITE OUTPUT FILE SUCCESS'

OUTREC DC 0CL15
FNAME DC CL5'VINAY'
LNAME DC CL5'KUMAR'
MNAME DC CL5'NAMA '
OUTFLE DCB DDNAME=OUTFILE, +
DSORG=PS, +
LRECL=80, +
MACRF=(PM), +
RECFM=FB
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Tue May 17, 2011 3:29 pm
Reply with quote

There is no length field preceding your outrec, and you dont have a branch to other coding after your DISMSG3.
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 17, 2011 3:35 pm
Reply with quote

Hi Peter/Umeysan,

Please let me know what is wrong with the below instructions. I am getting SOC1 abend.

OPEN (OUTFLE,(OUTPUT))
DISMSG2 WTO 'OPEN OUTPUT FILE SUCCESS'
PUT OUTFLE,OUTREC
DISMSG3 WTO 'WRITE OUTPUT FILE SUCCESS'
DISMSG6 WTO 'BEFORE DEFINE OUTREC'
OUTREC DC 0CL15
FNAME DC CL5'VINAY'
LNAME DC CL5'KUMAR'
MNAME DC CL5'NAMA '
DISMSG4 WTO 'AFTER DEFINE OUTREC'
OUTFLE DCB DDNAME=OUTFILE, +
DSORG=PS, +
LRECL=80, +
MACRF=(PM), +
RECFM=FB
XR R15,R15

JESMSGS shows 'OPEN OUTPUT FILE SUCCESS' , 'WRITE OUTPUT FILE SUCCESS' , 'BEFORE DEFINE OUTREC' and doesn't display anything that i have given after the OUTREC.

Kindly suggest. Thanks
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Tue May 17, 2011 3:36 pm
Reply with quote

vinayknj wrote:
Hi Nihal,

I am facing an ABEND SD23 when I used below instructions to display in JESMSG

DISMSG WTO TEXT=MSG1,ROUTCDE=11
MSG1 DC CL5'VINAY'



Vinay,

you need to have a detailed look at the code sample I gave in my first comment for this thread.

The first 2 bytes of your MSG1 field is the length of the number of characters or bytes you want to display. Try the below code as is and see the result:

Code:

DISMSG   WTO TEXT=MSG1,ROUTCDE=11
MSG1     DC  H'40'   
         DC  CL5'VINAY'
FILLER   DC  80CL1' '



Quote:
DISMSG WTO 'PROGRAM TESTPGM EXECUTING'

Yes, this will run ok because the length of the string is precalculated by the WTO macro itself
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 17, 2011 3:46 pm
Reply with quote

Hi Nihal,

The Job has displayed VINAY in JESMSGLG but the job abended with SOC1.
What might be the reason?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Tue May 17, 2011 3:53 pm
Reply with quote

vinayknj wrote:
Hi Nihal,

The Job has displayed VINAY in JESMSGLG but the job abended with SOC1.
What might be the reason?


Once again, you try to execute working storage after your WTO because you dont branch to executable code. If you dont understand that, stop trying to write an assembler program. And your SD23 abends are a result of not providing the length of your text. For the rest read the manual :

MVS Programming: Authorized
Assembler Services Reference, Volume 4
(SETFRR-WTOR)
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Tue May 17, 2011 3:54 pm
Reply with quote

vinayknj wrote:
Hi Nihal,

The Job has displayed VINAY in JESMSGLG but the job abended with SOC1.
What might be the reason?


Vinay,

From the error(S0C1) I guess that: you need to keep the WTO macro statement in the executable part of your program. MSG1 should be kept in the work area of your program(i.e. the part where you keep rest of your variables/fields).

A general rule is :Whenever you write a program control should never reach your work area.

This has already been suggested by a few others in the Forum.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue May 17, 2011 4:00 pm
Reply with quote

As has been said, you need to perform making your data readable, such as a register content, R1 for example -

Code:

DWORD    DS    D
WORKAREA DS    CL16
         ST    R1,DWORD             STORE IN 1ST-WORD
         UNPK  WORKAREA(9),DWORD(5) UNPACK AS 9-BYTES
         XC    DWORD,DWORD          ENSURE X'00'S
         MVZ   WORKAREA(8),DWORD    CLEAR ALL ZONES
         TR    WORKAREA(8),=CL16'0123456789ABCDEF'

Depending on the location in the program, you could remove the XC and MVZ and change the Translate-Table to =CL16'0123456789ABCDEF'-240, but the above will work for you and would be a different discussion for a different day. icon_wink.gif

When all is said and done, the readable register value can be found in WORKAREA(8).

Bill
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue May 17, 2011 4:04 pm
Reply with quote

@Peter

Make assurance double sure & Better safe than sorry

...in terms of repeating comments

As you could see in the last posts, it's still the same
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 17, 2011 4:06 pm
Reply with quote

Thanks Nihal/peter. Sorry for troubling u with silly questions.

I understood that we shouldn't execute the data fields and we should branch to the instructions instead.

I included below Branch instruction but still I am getting SOC1 abend.

DISMSG WTO TEXT=MSG1,ROUTCDE=11
B BACK .
MSG1 DC H'05'
DC CL5'VINAY'
FILLER DC 80CL1' '
BACK XR R15,R15
RETURN
END
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 -> PL/I & Assembler Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Split a record with data in a differe... DFSORT/ICETOOL 8
No new posts data moved using MVI on para-name. PL/I & Assembler 4
No new posts Setting CA7 user variable from data s... CA Products 7
No new posts pass data as symbolic parameter from ... CLIST & REXX 2
No new posts How to display the leading zeros of a... DB2 7
Search our Forums:

Back to Top