Hi,
I wrote code for comparison between three numbers. i defined three constants- num1,num2,num3 and a storage-great. i want to print the value of great in my spool. which instruction could i use.
thanks
Instruction to print value in storage to spool
-
- Global moderator
- Posts: 2105
- Joined: Thu Jun 03, 2010 6:21 pm
- Skillset: Assembler, JCL, utilities
- Referer: zos.efglobe.com
Re: Instruction to print value in storage to spool
There are a number of ways to print a value. All of them require more than one instruction. There is nothing in Assembler comparable to the standard C library printf("The greatest value is %d\n",biggest);
Re: Instruction to print value in storage to spool
yeah i know that its not that much easy as c. So could you please help me with that by providing instructions for prnting purpose
-
- Global moderator
- Posts: 3006
- Joined: Fri Apr 18, 2008 11:25 pm
- Skillset: tso,rexx,assembler,pl/i,storage,mvs,os/390,z/os,
- Referer: www.ibmmainframes.com
Re: Instruction to print value in storage to spool
unfortunately a Forum is not a training center
did You read the documentation for the tool You are using for the programming ...
the TX... macros should be documented somewhere
and probably You might find some dealing with I/O
anyway see here for example for some basic training topics
http://www.simotime.com/indexasm.htm
did You read the documentation for the tool You are using for the programming ...
the TX... macros should be documented somewhere
and probably You might find some dealing with I/O
anyway see here for example for some basic training topics
http://www.simotime.com/indexasm.htm
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
-
- Global moderator
- Posts: 2105
- Joined: Thu Jun 03, 2010 6:21 pm
- Skillset: Assembler, JCL, utilities
- Referer: zos.efglobe.com
Re: Instruction to print value in storage to spool
tanu_2302 wrote:Hi,
I wrote code for comparison between three numbers. i defined three constants- num1,num2,num3 and a storage-great. i want to print the value of great in my spool. which instruction could i use.
thanks
in Assembler - regardless of platform - there are two things you have to do
- Prepare the message you want print (e.g. sprintf("The value is ",%d\n",great);There is a lot of Assembler trickery here.
Code: Select all
ED LISTGRT,GREAT
...
TEXT DC AL2(L'MSG)
MSG DC 0C'THE VALUE IS NNN'
DC C'THE VALUE IS'
LISTGRT DC 0C' NNN',C' ',X'202120'
GREAT DC P'99'- AL2(L'MSG) Prepares a 2 byte binary value with the length attribute assigned to a label.
- 0C'THE VALUE IS NNN' defines storage, but does not actually emit any text.
- 0C' NNN',C' ',X'202120' This does the previous bullet and then adds additional data. In total, this data builds an ED instruction pattern area. I am not going to go into this instruction here. This link goes to the z/Architecture Principles of Operation manual that discusses the the instruction in detail.
- "print ... in my SPOOL" is terribly vague. There are many places "in my SPOOL" where you can send messages; the method used here will send the message to the JESMSGLG data set where it can be viewed using SDSF. Add this instruction immediately after the ED machine instruction.The WTO instruction does not require additional preparation. ROUTCDE=11,DESC=7 directs the system to send the message to the JESMSGLG SPOOL data set. The message will also appear in the JESYSMSG data set, but it is harder to find there.
Code: Select all
WTO TEXT=TEXT,ROUTCDE=11,DESC=7
Re: Instruction to print value in storage to spool
Thanks Steve for your help 

-
- Posts: 474
- Joined: Thu Mar 10, 2016 5:03 pm
- Skillset: assembler rexx zOS ispf racf smf
- Referer: saw it in the experts foprum thought I could help here
Re: Instruction to print value in storage to spool
Or write to a sysout file like shown below.
Code: Select all
open (print,(OUTPUT))
- - - - - - - - - - - - - - - - - - - 1 Line(s) not Displayed
mvc printrec,blank
mvc printrec(6),=cl6'Header'
mvc printrec+7(100),data
put print,printrec
- - - - - - - - - - - - - - - - - - - 1 Line(s) not Displayed
close (print)
- - - - - - - - - - - - - - - - - - - 3 Line(s) not Displayed
print dcb ddname=PRINT,macrf=PM,dsorg=PS,lrecl=l'printrec
printrec dc cl132' '
blank dc cl132' '
data dc cl100'testdata '
ltorg
- - - - - - - - - - - - - - - - - - - 8 Line(s) not Displayed
//PRINT DD SYSOUT=*
-
- Global moderator
- Posts: 2105
- Joined: Thu Jun 03, 2010 6:21 pm
- Skillset: Assembler, JCL, utilities
- Referer: zos.efglobe.com
Re: Instruction to print value in storage to spool
Two problemsSorry about the complicated way the output message is defined.
Sadly, perhaps, but I've become addicted to complex DC statements like
0C' NNN',C' ',X'202120',CL(L'MSG-(*-MSG))' '
0C' NNN',C' ',X'202120'
Specifies the edit instruction pattern. 0C' NNN' is a relatively high level abstraction of the effect of the pattern, and
C' ',X'202120' is the actual pattern. Personally, I find this better than X'40202120' since I don't have to memorize 40 as an EBCDIC blank, even though most Assembler programmers have this memorized - even me. However -
OUTVAL DC 0C' NNN,NNN,NNN',C' ',3X'20',C',',3X'20',X'202120'
After more than 40 years one would think I have comma memorized. But I don't!
CL(L'MSG-(*-MSG))' ' Fills out the line with blanks. L'MSG is the Assembler determine length of the data area specified by the symbol MSG, so
(L'MSG-(*-MSG)) becomes the bytes to fill out the line *-MSG directs the Assembler to calculate the number of bytes from the address assigned to MSG and the location counter.
- Many more than one one instruction
- Does not convert a two byte packed decimal number to decimal digits
Code: Select all
OPEN (PRINT,OUTPUT)
ED OUTVAL,DATA
PUT PRINT,MSG
...
PRINT DCB DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,RECFM=FBA,LRECL=121
DATA DC P'12'
MSG DC 0CL121' THE VALUE IN DATA IS NNN'
DC C' THE VALUE IN DATA IS'
OUTVAL DC 0C' NNN',C' ',X'202120',CL(L'MSG-(*-MSG))' '
Sadly, perhaps, but I've become addicted to complex DC statements like
0C' NNN',C' ',X'202120',CL(L'MSG-(*-MSG))' '
0C' NNN',C' ',X'202120'
Specifies the edit instruction pattern. 0C' NNN' is a relatively high level abstraction of the effect of the pattern, and
C' ',X'202120' is the actual pattern. Personally, I find this better than X'40202120' since I don't have to memorize 40 as an EBCDIC blank, even though most Assembler programmers have this memorized - even me. However -
OUTVAL DC 0C' NNN,NNN,NNN',C' ',3X'20',C',',3X'20',X'202120'
After more than 40 years one would think I have comma memorized. But I don't!
CL(L'MSG-(*-MSG))' ' Fills out the line with blanks. L'MSG is the Assembler determine length of the data area specified by the symbol MSG, so
(L'MSG-(*-MSG)) becomes the bytes to fill out the line *-MSG directs the Assembler to calculate the number of bytes from the address assigned to MSG and the location counter.
-
- Similar Topics
- Replies
- Views
- Last post
-
- 7
- 5222
-
by sergeyken
View the latest post
Fri Nov 13, 2020 1:24 am
-
- 1
- 8382
-
by sergeyken
View the latest post
Wed Nov 16, 2022 8:31 pm
-
- 1
- 1553
-
by willy jensen
View the latest post
Fri Feb 23, 2024 1:59 pm
-
-
Sorted but want to print all discarded records
by Everlast » Thu Dec 30, 2021 1:28 am » in DFSORT/ICETOOL/ICEGENER - 1
- 2401
-
by sergeyken
View the latest post
Thu Dec 30, 2021 11:47 pm
-
-
-
Sending o/p file's content to spool withot adding extra step
by Misha786 » Tue Jan 12, 2021 6:51 pm » in JCL - 4
- 2032
-
by sergeyken
View the latest post
Tue Jan 12, 2021 11:28 pm
-