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
 

 

table in ASSEMBLER with incorrect value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
RogerQ

New User


Joined: 20 Aug 2008
Posts: 10
Location: China

PostPosted: Mon Aug 25, 2008 2:37 pm    Post subject: table in ASSEMBLER with incorrect value
Reply with quote

here is my pg, i just want to create a table from input file
Code:
000001 ********************************************************************* 
000002 * PROGRAM: CRETABLE.                                                * 
000003 * PURPOSE: DEMONSTATION ASSEMBLER PROGRAM                           * 
000004 * DESIGN : ROGERQ                                                   * 
000005 * DATE   : AUGUST, 2008                                              *
000006 ********************************************************************* 
000007 CRETABLE CSECT                                                         
000008 * DEFINE REGISTER EQUALS USING IBM STANDARD MACRO YREGS               *
000009          YREGS                                                         
000010 * BUILD UP BASE REGISTERS FOR THE PROGRAM                             *
000011          USING CRETABLE,R15       ;R15 IS CURRENT ADDRESS, USING IT   
000012          SAVE  (14,12)            ;SAVE CALLER'S REGISTERS USING SAVE 
000013          LR    R12,R15            ;COPY THE CURRENT CSECT LOCATION     
000014          DROP  R15                ;DROP THE TEMPORARY USING           
000015          USING CRETABLE,R12       ;USE R12 AS BASE REG FROM NOW ON     
000016 * BUILD LINKAGE OF THIS PROGRAM AND THE CALLER.                       
000017          ST    R13,SAVEAREA+4     ;SET OUR BACKWARD LINK IN OUR SAVE   
000018          LA    R15,SAVEAREA       ;LOAD ADDR OF OUR SAVEAREA TO R15   
000019          ST    R15,8(R13)         ;SET CALLER(MYSELF)'S FORWARD LINK   
000020          LR    R13,R15            ;LOAD OUR SAVEAREA ADDR TO R13.     
000021 * MAIN PROGRAM BEGINS HERE                                             
000022 * INITIALIZE POINTER OF THE TABLE                     
000024          LA    R3,TABLE           ;SET POINTER TO BEGINING             
000025 * READ THE 1ST RECORD                                                 
000026          OPEN  (FILEIN,INPUT,SYSPRINT,OUTPUT)                         
000027 LOOP     GET   FILEIN,CARD                                             
000028          PUT   SYSPRINT,CARD                                           
000029          L     R2,CARD                                                 
000033 * ADD VALID VALUE TO THE TABLE                                         
000034          ST    R2,0(R3)           ;PUT INTO TABLE FROM R3 ADDRESS     
000036          LA    R3,4(R3)           ;DIRECT COUNTER TO NEXT RECORD       
000037 * READ NEXT RECORD                                                     
000038          B     LOOP                                                   
000039 * PRINT THE WHOLE TABLE                                               
000041 ENDINPUT PUT   SYSPRINT,TABLE      ;WRITE THE TABLE                     
000044          CLOSE SYSPRINT            ;CLOSE SYSPRINT FILE                 
000045          CLOSE FILEIN              ;CLOSE SYSPRINT FILE                 
000046 *        LTORG                                                         
000047 * RETURN LINKAGE TO THE CALLER                                         
000048          L     R13,4(R13)         ;LOAD ADDR OF CALLER'S SAVEAREA       
000049          RETURN (14,12),RC=0      ;RESTORE CALLER'S REGS AND RETURN     
000051 * STATIC STORAGE AREA                                                   
000052 SAVEAREA DS    18F                ;REGISTER SAVE AREA                   
000053 CARD     DS    CL80                                                     
000054 TABLE    DS    50CL8                                                     
000056 SYSPRINT DCB   DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,RECFM=FB,LRECL=80     
000057 FILEIN   DCB   DSORG=PS,MACRF=GM,DDNAME=FILEIN,RECFM=FB,LRECL=80,      X
000058                BLKSIZE=3600,EODAD=ENDINPUT                             
000059          END   CRETABLE                                                 


here is my input file
Code:
000001 11112222
000002 22223333
000003 99998888


but i get the sysprint as below:
Code:
11112222                                                                       
22223333                                                                       
99998888                                                                       
111122229999                                                                   

the table content become 111122229999
what i expected is 111122222222333399998888
i cant find where the data is truncated
could you guys give me some ideas ?
thanks very much!
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Mon Aug 25, 2008 4:54 pm    Post subject:
Reply with quote

Code:
000036          LA    R3,4(R3)           ;DIRECT COUNTER TO NEXT RECORD   
Are the table entries 4 bytes long or 8 bytes long?
Back to top
View user's profile Send private message
RogerQ

New User


Joined: 20 Aug 2008
Posts: 10
Location: China

PostPosted: Tue Aug 26, 2008 6:38 am    Post subject:
Reply with quote

the table is 8 bytes long


Code:
TABLE    DS    50CL8


i also tried this

Code:
TABLE    DS    50F


whatever i define the table, i get the same results
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 26, 2008 6:53 am    Post subject:
Reply with quote

Hello,

Your problem is not the table definition.

Please review the post from Robert. You increment the address by 4. . .
Back to top
View user's profile Send private message
RogerQ

New User


Joined: 20 Aug 2008
Posts: 10
Location: China

PostPosted: Tue Aug 26, 2008 7:15 am    Post subject:
Reply with quote

thanks, Dick and Robert

i tried again, using this

Code:
000036          LA    R3,8(R3)           ;DIRECT COUNTER TO NEXT RECORD


but, i get the value

Code:
1111    2222    9999   
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 26, 2008 7:32 am    Post subject:
Reply with quote

Hello,

You are also only storing 4 bytes into the table. . .

Code:
                L     R2,CARD                                                 
000033 * ADD VALID VALUE TO THE TABLE                                         
000034          ST    R2,0(R3)           ;PUT INTO TABLE FROM R3 ADDRESS     
You are using register instructons and i believe you'll do better with a storage instruction (MVC).
Back to top
View user's profile Send private message
RogerQ

New User


Joined: 20 Aug 2008
Posts: 10
Location: China

PostPosted: Tue Aug 26, 2008 9:04 am    Post subject:
Reply with quote

thanks, Dick

i got it, u means, it will meet the 4 bytes limit if i use register instructions
and it will be better useing MVC

but, if i use MVC, i can only move between lables, and, i cant put the value to register, so, how can i realize the pointer moving, you know, now i use R3 to move pointer,
Code:
LA    R3,4(R3)           ;DIRECT COUNTER TO NEXT RECORD       
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 26, 2008 10:23 am    Post subject:
Reply with quote

Hello,

Quote:
but, if i use MVC, i can only move between lables
Well, not quite.

You may specify the sending field, the receiving field, or both by label or by register&displacement.

Which assembler reference material are you using?
Back to top
View user's profile Send private message
RogerQ

New User


Joined: 20 Aug 2008
Posts: 10
Location: China

PostPosted: Tue Aug 26, 2008 11:26 am    Post subject:
Reply with quote

thanks for your tips

i just using a simple chinese version assembler book, maybe it's not suitable, i will try to get a better one from our forums
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Tue Aug 26, 2008 4:56 pm    Post subject:
Reply with quote

Code:
000029          L     R2,CARD                                                 
000033 * ADD VALID VALUE TO THE TABLE                                         
000034          MVC   0(8,R3),CARD       ;PUT INTO TABLE FROM R3 ADDRESS     
000036          LA    R3,8(R3)           ;DIRECT COUNTER TO NEXT RECORD     
would fix your problem.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 26, 2008 7:31 pm    Post subject:
Reply with quote

Hello,

There is a book from Murach Publishing written by Kevin McQuillen that is very good for people just starting in assembler. It begins from knowing nothing of assembler syntax and the instructions. Once you complete that book, the ibm reference manuals have more detail. So far, it is the best mainframe assembler for beginners i've worked with. For a time it was used in several universities as their text for assembler studies.

The ibm manuals are excellent for resolviing a question, but i do not believe them to be a good way to learn from scratch.

Near the top of the PL/I & Assembler part of the forum is a "Sticky" with considerable information:
http://ibmmainframes.com/viewtopic.php?t=2744

Good luck icon_smile.gif
Back to top
View user's profile Send private message
RogerQ

New User


Joined: 20 Aug 2008
Posts: 10
Location: China

PostPosted: Wed Aug 27, 2008 6:39 am    Post subject:
Reply with quote

hi, i just found the book name in the link, but cant find where to download it , could you pls tell me where i can read that book ?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Aug 27, 2008 7:06 am    Post subject:
Reply with quote

Hello,

The McQuillen Assembler book i mentioned can be purchased from Murach Publishing. They can be reached at www.murach.com.

They are not free, the book must be purchased. Here is the table of contents for the book:
http://www.murach.com/books/mbal/toc.htm
Back to top
View user's profile Send private message
RogerQ

New User


Joined: 20 Aug 2008
Posts: 10
Location: China

PostPosted: Wed Aug 27, 2008 7:16 am    Post subject:
Reply with quote

Dick , thanks!
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Aug 27, 2008 7:43 am    Post subject: Reply to: table in ASSEMBLER with incorrect value
Reply with quote

You're welcome - good luck icon_smile.gif

d
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 -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts Updating online Db2 table kishpra DB2 3 Fri Aug 12, 2016 2:44 pm
No new posts Online Assembler Program Starting point Aditya.Srivastava PL/I & Assembler 4 Fri Jul 08, 2016 6:48 pm
No new posts Getting soc4 on internal table in cobol abdulrafi COBOL Programming 13 Fri May 06, 2016 3:39 pm


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