Page 1 of 1

How to replace XDECI using PACK and CVB?

PostPosted: Sat Mar 29, 2014 3:20 am
by sudeepth
HI Sir,

I have a zoned decimal and an input with all numbers in it , My requirement is to read the input using a subroutine(without using XDECI and XDECO ).

PROTABLE DSECT
PRICE    DS    4Z
MAIN     CSECT
         STM   R14,R12,12(R13)      Saves calling regs (not R13)
         LR    R12,R15              Address of MAIN in R12
         LA    R11,4095(,R12)       
         LA    R11,1(,R11)         
         USING MAIN,R12,R11         
         LA    R14,MAINSAVE         Where regs are stored when calls
         ST    R13,4(,R14)          stores backward pointer
         ST    R14,8(,R13)          Stores forward pointer
         LR    R13,R14
*
*
         LA    R1,BLDLIST           Loading the parameter list
         L     R15,=V(BUILD)        Calling the BUILD subroutine.
         BALR  R14,R15
*
*
         L     R13,4(,R13)          Loads address of calling rtn regs
         LM    R14,R12,12(R13)      Reloads calling routines regs
         BR    R14                  Return control
         LTORG
*****Variables for MAIN*****
MAINSAVE DS    18F                  Storage for registers
BLDLIST  DC    A(CARD)
CARD     DS    CL80
****************************
BUILD    CSECT
         STM   R14,R12,12(13)
         LR    R12,R15
         USING BUILD,R12
         LA    R14,BLDSAVE
         ST    R13,4(0,14)     Save the forward pointer.
         ST    R14,8(0,13)     Save the backward pointer.
         LR    R13,R14
         SR    R6,R6
         LM    R2,0(1)
         USING PROTABLE,R3
*
*
TOP1     XREAD 0(0,R2),80       Reading the card
         BC    B'0100',END1     Check for EOF
*       Here I need to read the values from CARD
*       and PRINT them in the output.
*
*
******BUILD METHOD EXIT LINKAGE*****
         L     R13,4(0,13)     Loads address of calling REGS
         LM    R14,R12,12(13)  Reloads calling routines
         BR    R14             Return control
         LTORG
******BUILD METHOD VARIABLES**********
*
*
BLDSAVE  DS    18F

Re: How to replace XDECI using PACK and CVB?

PostPosted: Sat Mar 29, 2014 3:56 am
by NicC
My requirement is to read the input using a subroutine(without using XDECI and XDECO ).

That's nice. Do you have a question? Are you stuck with something? If so, what?

Re: How to replace XDECI using PACK and CVB?

PostPosted: Sat Mar 29, 2014 4:18 am
by sudeepth
In the subroutine build i have commented " Here I need to read the values from CARD and PRINT them in the output(without using XDECI and XDECO)".

Re: How to replace XDECI using PACK and CVB?

PostPosted: Sat Mar 29, 2014 4:32 am
by Robert Sample
XDECI and XDECO are ASSIST instructions. As such, you will have your work cut out replacing XDECI (but XDECO should be pretty easily replaced as long as you have a good understanding of Assembler), based on the ASSIST manual description:
XDECI

XDECI is generally used to scan a data card read by XREAD. The
sequence of actions performed by XDECI is as follows:

1. Beginning at the location given by ADDRESS, memory is scanned
for the first character which is not a blank.

2. If the first character found is anything but a decimal
digit or plus or minus sign, register 1 is set to the address
of that character, and the condition code is set to 3 (overflow)
to show that no decimal number could be converted. The contents
of REG are not changed, and nothing more is done.

3. From one to nine decimal digits are scanned, and the number
converted to binary and placed in REG, with the appropriate sign.
The condition code is set to 0 (0), 1 (-), or 2 (+), depending
on the value just placed in REG.

4. Register 1 is set to the address of the first non-digit after
the string of decimal digits. Thus REG should not usually be 1.
This permits the user to scan across a card image for any number
of decimal values. The values should be separated by blanks, since
otherwise the scanner could hang up on a string like -123*, unless
the user checks for this himself. I.e. XDECI will skip leading blanks
but will not itself skip over any other characters.

5. During step 3, if ten or more decimal digits are found,
register 1 is set to the address of the first character found
which is not a decimal digit, the condition code is set to 3, and
REG is left unchanged. A plus or minus sign alone causes a similiar
action, with R1 set to the address of the character following
the sign character.

XDECO

XDECO converts the value from REG to printable decimal, with
leading zeroes removed, and a minus sign prefixed if needed. The
resulting character string is placed right-justified in a 12-byte
field beginning at ADDRESS. It can then easily be printed using
an XPRNT instruction. The XDECO instruction modifies NO registers.
Since this is a HELP forum, and not a WRITE-THE-CODE-FOR-YOU forum, tell us what you have done to implement the code you need and where you are having problems. Also, you mentioned CVB in your post title but did not mention CVD, which will also be required for XDECO.

Re: How to replace XDECI using PACK and CVB?

PostPosted: Sat Mar 29, 2014 9:08 am
by steve-myers
Another approach, though it may be more involved than you want to do is obtain the Assist package from http://www.cbttape.org. The Assist pseudo operations like XDECI and XDECO can be retrieved as Assembler macros relatively easily. The macros call external subroutines. Extracting the subroutines is somewhat more involved, but far from impossible.

XDECI is moderately difficult for a neophyte, but not impossible. On the other hand XDECO is relatively simple. You have to learn a little bit about instructions like CVD (Convert binary to Decimal) and EDMK (Edit and Mark).

         MACRO
&NAME    XDECO &REG,&ADDRESS
.* REG -- ANY REGISTER
.* ADDRESS -- ANY STORAGE ADDRESS ADDRESSABLE BY AN RX ADDRESS
.* REGISTER 13 MUST POINT TO AN EMPTY REGISTER SAVE AREA
.* REGISTERS 0,1 AND 15 ARE DESTROYED
&NAME    ST    &REG,12(,13)
         CVD   &REG,16(,13)
         LA    15,&ADDRESS
         MVC   0(12,15),=X'402020202020202020202120'
         LA    1,11(,15)
         EDMK  0(12,15),18(13)
         L     0,12(,13)
         LTR   0,0
         BNM   *+L'*+6
         BCTR  1,0
         MVI   0(1),C'-'
         MEND