Page 2 of 3

Re: how to convert string to number?

PostPosted: Sun Mar 14, 2010 11:38 pm
by helen2000
thanks Mr. Dick and Robert. by the way, what my understanding is: move num0 to num1, actually, exist
a assmeber statement does like that: nnnnbb or x'0000000000f0' ==>num1, so we got nnnnb0, is that right?
(I'm sorry, maybe I need learn assemble language right now :oops: ),
Mr. Robert? I don't know how to check the assembler statement in our output, do you have some idea, I can
try that if you have good idea. thanks very very much!

have a good day!

helen

Re: how to convert string to number?

PostPosted: Mon Mar 15, 2010 3:24 am
by dick scherrer
Hi Helen,

I'm sorry, maybe I need learn assemble language right now
At this point i suspect that being able to read some assembler would be helpful :)
These links are to a Princilpes of Operations (The Bible :) ), a site that shows many assembler instruction examples, and an Introduction for Assembler.
http://publibz.boulder.ibm.com/cgi-bin/ ... 0504121320

http://www.simotime.com/asmins01.htm

http://ulita.ms.mff.cuni.cz/pub/predn/s ... BM_390.pdf

actually, exist a assmeber statement does like that: nnnnbb or x'0000000000f0' ==>num1, so we got nnnnb0, is that right?
Not quite, i suspect. And depending on exactly which compiler with which options in effect, the generated code might be different.

I don't know how to check the assembler statement in our output
Specify LIST in the COBOL options for the compile. You will see something like:
000044  MOVE                                                             
   00069A  D205 8978 A0B1          MVC   2424(6,8),177(10)       NUM0   
000045  MOVE                                                             
   0006A0  D201 897E C02A          MVC   2430(2,8),42(12)        NUM1   
   0006A6  D205 8980 8978          MVC   2432(6,8),2424(8)       NUM1+2 
   0006AC  96F0 8985               OI    2437(8),X'F0'           NUM1+7 
000046  IF                                                               
   0006B0  F247 D120 897E          PACK  288(5,13),2430(8,8)     TS2=0   
   0006B6  960F D124               OI    292(13),X'0F'           TS2=4   
   0006BA  F245 D128 8986          PACK  296(5,13),2438(6,8)     TS2=8   
   0006C0  960F D12C               OI    300(13),X'0F'           TS2=12 
   0006C4  D504 D120 D128          CLC   288(5,13),296(13)       TS2=0   
   0006CA  4770 B1B8               BC    7,440(0,11)             GN=5(000
000047  DISPLAY                                                         
   0006CE  5820 905C               L     2,92(0,9)               TGTFIXD+
   0006D2  58F0 202C               L     15,44(0,2)              V(IGZCDS
   0006D6  4110 A3B3               LA    1,947(0,10)             PGMLIT A
   0006DA  0DEF                    BASR  14,15                           
which is from the experiment using the 8-byte num1.

Re: how to convert string to number?

PostPosted: Tue Mar 16, 2010 3:03 am
by helen2000
I'm very appreciate Mr. Dick for detail answer and valuable assembler link. would you mind I ask for further question;
MOVE '9754' TO NUM0
MOVE NUM0 TO NUM1

I got relative assemble:
000191  MOVE                                                           
   0008A2  D205 805A A0BB          MVC   90(6,8),187(10)         NUM0   
000192  MOVE                                                           
   0008A8  D205 8060 805A          MVC   96(6,8),90(8)           NUM1   
   0008AE  96F0 8065               OI    101(8),X'F0'            NUM1+5


for the first assemble statement, MVC 90(6,8),187(10) , it's means: the 6 bytes content of offset (R10)+187 copy to offset (R8)+90;
could you tell me how to check R8 and R10 in my assemble code, I'm not sure if the following data area is helpful for the question. or
let me know if you need more information,thanks.
000148  (LIT+0)      FFFFFFFC 00001000 00000001 00000000 5C5C40D4 D7E8D8F8 C6C3D
000168  (LIT+32)     C1D9E340 D6C640E6 D6D9D2C9 D5C740E2 E3D6D9C1 C7C5405C 5CE3D
000188  (LIT+64)     C5C3D6D9 C4E240D7 D9D6C3C5 E2E2C5E2 7AD5E4D4 F040C9E2 D57DE
0001A8  (LIT+96)     C5D95AC3 D6D5E5C5 D9E2C9D6 D540C6C1 C9D35AD5 E4D4F040 C9E24
0001C8  (LIT+128)    C9C3E2E4 C3C3C5E2 E2C6E4D3 5AE2E8E2 D6E4E340 40C9C7E9 E2D9E
0001E8  (LIT+160)    F27E40F9 F7F5F440 40C8F2C4 C3C2D3D5 E4D4F17E D5E4D4F0 7EE6C
000208  (LIT+192)    D51F1010 10101010 10101010 10101010 10101010 10101010 10101
000228  (LIT+224)    10101010 10101010 10101010 10101010 10101010 10101010 10101
000248  (LIT+256)    10101010 10101010 10101010 10101010 10101010 10101010 10101
000268  (LIT+288)    10101010 10101010 10101010 10101010 10101010 10101010 10101
000288  (LIT+320)    10101010 10101010 10101010 10101010 10101010 10101010 10101
0002A8  (LIT+352)    10101010 10101010 10101010 10101010 10101010 10101010 10101
0002C8  (LIT+384)    10108080 80808080 80808080 10101010 10108080 80808080 80808
0002E8  (LIT+416)    10101010 10101010 10101010 10101010 10100000 00000000 00000
000308  (LIT+448)    10100000 01340000 00020000 012C0000 00010000 01300000 00010

by the way, what does "LIT" means?
helen

Re: how to convert string to number?

PostPosted: Tue Mar 16, 2010 3:11 am
by dick scherrer
Hi Helen,

I'm not sure if the following data area is helpful for the question. or let me know if you need more information,thanks.
by the way, what does "LIT" means?
For this question, the data area (the program's literals) not so much. LIT in this case is for "literal" - as in Literal Pool:
LITERAL POOL MAP FOR LITERALS IN THE CGT:                               
                                                                         
000188  (LIT+0)      FFFFFFFC 00001000 40000000 00000328 00000001 FFFFFFF
0001A8  (LIT+32)     00000262 00404400 00000248 00000229 00000068 0000021
0001C8  (LIT+64)     0000017E 00000159 00400000 000001C8 00000139 0040040
Notice the line just before the "data area" you posted.

I know of no way to check register content from a complie/assembly listing. To verify content of registers (and storage locations) a dump would be needed.

Re: how to convert string to number?

PostPosted: Tue Mar 16, 2010 3:21 am
by dick scherrer
Add on. . .

Keep in mind that register content is only valid for a very brief moment. Register content/values are modified very often.

What i believe you would be most interested in is the data contained at the addresses contained in certain registers.

Re: how to convert string to number?

PostPosted: Tue Mar 16, 2010 3:26 am
by Robert Sample
Two points to consider:
1. Even though you are moving '9754' to NUM0, notice that the assembler instruction generated is moving six bytes. The two spaces are in the literal pool at the end of the 9754. Alphanumeric moves, unless you are using reference modification, move the length of the data field whether or not your source is that long.

2. After moving the same six bytes to NUM1, the OI assembler instruction changes the last byte (offset NUM1+5) to a hex 'F0' which is a zero. COBOL is guaranteeing the value is unsigned by doing so.

Re: how to convert string to number?

PostPosted: Tue Mar 16, 2010 9:10 am
by helen2000
thanks so much, Mr. Dick and Robert,
What i believe you would be most interested in is the data contained at the addresses contained in certain registers

exactly correct! for the assmebler statement: MVC 90(6,8),187(10) NUM0
I want to check if the address 187(10) is 9754bb.
To verify content of registers (and storage locations) a dump would be needed

could you give me a sample about dump so that I can follow you to verify the register R10 and R8?
Wow, thanks for GOD, I got your help, otherwise I can't sleep tonight.

Helen

Re: how to convert string to number?

PostPosted: Tue Mar 16, 2010 9:21 am
by dick scherrer
Hi Helen,

One way to generate a dump is to force an abend (i.e. cause a s0c7)

Another is to generate an LE (Language Environment) dump - look here:
http://publibz.boulder.ibm.com/cgi-bin/ ... g50/1.13.1

Re: how to convert string to number?

PostPosted: Wed Mar 17, 2010 3:04 am
by helen2000
I'm sorry, Mr. Dick. I tried lots of ways but I can't get the S0c7. I always get compile failure once I modify any code,
could you give me some detail, thanks,
have a good day!
helen

Re: how to convert string to number?

PostPosted: Wed Mar 17, 2010 4:31 am
by Robert Sample
I thought usually the problem was programmers could not get rid of S0C7 abends ... sigh ... this code will do generate one:
       WORKING-STORAGE SECTION.
       01  WS-DATA.
           05  WS-VAR1                 PIC X(04) VALUE SPACES.
           05  WS-VAR2                 REDEFINES WS-VAR1
                                       PIC S9(04).
      *
       PROCEDURE DIVISION.
       S1000-INITIALIZE.
           ADD 1                       TO  WS-VAR2.
           GOBACK.