iob mainpulation



High Level Assembler(HLASM) for MVS & VM & VSE

iob mainpulation

Postby belkin99 » Sat Apr 16, 2011 1:49 am

Hi,
I am using the following code, to get data from an IOB
        LA    R2,READIOB                   
        LA    R3,READDCB                   
        USING IHADCB,R3
        USING IOBSTDRD,R2
        MVC   IOBFLAG1,X'2A'           initilize flag1
        LA    R4,READECB                 get address of read dcb that i create
        ST    R4,IOBECBPT                 
        LA    R4,READDCB
        ST    R4,IOBDCBPT                 
        MVC   IOBECBPT,                   
        MVC   IOBSTART,READCCWS           
        MVC   IOBDCBPT,                   
        DEVTYPE MYDD,DEVTAREA,DEVTAB     
        SR    R4,R4                       
        LH    R4,TRKPCYL                   
        BCTR  R4,0                         
        ST    R4,HIGHTRK                   
        L     R4,DCBDEBAD
        USING DEBBASIC,R4
        MVC   EXTTOT(1),DEBNMEXT
        LA    R4,32(R4)
        USING DEBDASD,R4


can anyone help to figure what is wrong I did ??
Thanks
belkin99
 
Posts: 25
Joined: Mon Aug 30, 2010 6:59 pm
Has thanked: 0 time
Been thanked: 0 time

Re: iob mainpulation

 

Re: iob mainpulation

Postby steve-myers » Sat Apr 16, 2011 4:21 am

Your code has more problems than, to use a phrase about a worthless product heavily promoted in the US in the 1950s, Carter has little liver pills.

You've setup IOBECBPT correctly, so what are you trying to move into it later?

Same for IOBDCBPT.

IOBSTART is the address of the first CCW in your channel program. It is not the first CCW.

Do not attempt to initialize IOBSEEK yourself. It is more difficult than you think. IBM provides an excellent subroutine to translate a TTR (TT is a relative track in the dataset, R is the record) to the disk address in IOBSEEK. The address of this routine is in the CVT, in CVTPCNVT. Use it.

For that matter, where are you getting the TTR from? That can be difficult, too.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: iob mainpulation

Postby steve-myers » Sat May 28, 2011 12:45 am

What follows is a complete program to read the first record of a disk dataset. It illustraes the use of the TTRN to MBBCCHHR converion routine as well as a correct channel program to locate and read a record from disk.
READR1   CSECT
         PUSH  PRINT
         PRINT NOGEN
         CVT   DSECT=YES
         DCBD  DSORG=QS,DEVD=DA
         POP   PRINT
READR1   CSECT
         USING *,12
         SAVE  (14,12),,'READ TRACK 0 RECORD 1 &SYSDATE &SYSTIME'
         LR    12,15               COPY ENTRY POINT ADDRESS TO REG 12
         LA    15,SAVEAREA         LOAD ADDRESS OF THE NW SAVE AREA
         ST    15,8(,13)           ADD THE NEW SAVE AREA TO THE
         ST    13,4(,15)            SAVE AREA CHAIN
         LR    13,15               ESTABLISH THE NEW SAVE AREA POINTER
         OPEN  (EXCPDCB,INPUT)     OPEN THE DCB
         L     0,=X'00000100'      LOAD THE TTRN INTO REG 0
         L     1,DCBDEBAD-IHADCB+EXCPDCB  LOAD THE ADDRESS OF THE DEB
         LA    2,IOBSEEK           LOAD ADDRESS OF IOBSEEK
* THE TTRN TO MBBCCHHR CONVERSION ROUTINE DESTROYS REGISTER 9 THROUGH
* 13, SO WE SAVE REGISTERS 8 THROUGH 13 IN THE SAVE AREA, COPY REGISTER
* REGISTER 13 TO REGISTER 8 BEFORE WE CALL THE CONVERSION ROUTINE, AND
* RESTORE REGISTER 8 THROUGH 13 FR OM THE SAVE AREA AFTER THE
* CONVERSION ROUTINE RETURNS
         STM   8,13,12(13)         SAVE REGISTERS 8 THROUGH 13 IN      X
                                    THE SAVE AREA
         LR    8,13                COPY THE SAVE AREA POINTER TO REG 8
         L     15,CVTPTR           LOAD ADDRESS OF THE CVT
         L     15,CVTPCNVT-CVTMAP(,15)  LOAD ADDRESS OF THE TTRN TO    X
                                         MBBCCHHR CONVSERION ROUTINE
         BASR  14,15               CONVERT TTRN TO MBBCCHHR
         LM    8,13,12(8)          RESTORE REGISTERS 8 THROUGH 13
         MVI   EXCPECB,0           RESET THE ECB
         EXCP  IOB                 READ THE RECORD
         WAIT  1,ECB=EXCPDCB       WAIT FOR THE I/O TO COMPLETE
         CLOSE EXCPDCB             CLOSE THE DCB
         L     13,4(,13)           LOAD ADDR OF THE PREVIOUS SAVE AREA
         RETURN (14,12),T,RC=0     RESTORE REGISTERS AND RETURN
SAVEAREA DC    18F'0'              SAVE AREA
         PUSH  PRINT
         PRINT NOGEN
EXCPDCB  DCB   MACRF=E,DDNAME=INPUT  DCB
         POP   PRINT
EXCPECB  DC    F'0'                I/O ECB
*  THE OPERATING SYSTEM ADDS A FULL SEEK COMMAND BEFORE THIS CHANNEL
*  PROGRAM EXECUTES AS WELL AS A SET FILE MASK COMMAND TO RESTRICT
*  THE COMMANDS IN THE REMAINDER OF THE CHANNEL PROGRAM.
*  THE SEARCH ID EQUAL COMMAND CAUSES THE CONTROL UNIT TO READ THE
*  TRACK TO THE NEXT COUNT AREA, THEN COMPARE THE STORAGE WITH THE
*  RECORD ID PORTION OF THE COUNT AREA.  IF THE COMPARE IS EQUAL, THE
*  NEXT CCW IS SKIPPED.  IF THE COMPARE IS NOT EQUAL, THE NEXT CCW IS
*  EXECUTED.
READCCWS CCW   X'31',IOBSEEK+3,X'40',5    SEARCH ID EQUAL
         CCW   X'08',READCCWS,0,0         TRANSFER IN CHANNEL IF ID    X
                                           WAS NOT EQUAL
         CCW   X'06',IOBUF,X'20',L'IOBUF  READ DATA
IOB      DC    0XL40'0',AL1(X'42',0,0,0),A(EXCPECB,0,0,READCCWS,EXCPDCB>
               ,0,0)               IOB
IOBSEEK  DC    XL8'0'              BMMCCHHR STORED HERE
         LTORG ,                   DEFINE THE LITERAL POOL
         DC    0D'0'
IOBUF    DS    XL(32*1024)         I/O BUFFER
         END   READR1
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times


Return to Assembler