Hi everyone,

I have an RPGLE program that is calling some old MI code via a special 
file defination.  When the MI program is call I get MCH0601 (Space offset 
or teraspace offset is outside current limit for object...).  I've had 
Rochester looking into this and all they can suggest is to recompile the 
programs, which I've done to no avail.  I've also performed a reclaim 
storage in case any objects were damaged or lost.

Until a few weeks ago this was working fine, so it has me wondering if a 
PTF or something has created a problem with MI level code or parameters or 
something.  I've included the code I suspect is the cause of the problem 
below.  Let me know if you want the whole program listing.  The MCH0601 
occurs at statement 43 in the MI program, I have this line highlighted. 
Any help is appreciated.

< ---- RPGLE Code ---->
   
     FPdoc014   CF   E             Special Pgmname('MDOC')
     F                                     Usropn
     F                                     Plist(Iolist)
     ?*****************************************************************
     ?*  read work area
     ?*****************************************************************
BGSR C     Readsp        Begsr
     ?*
     C                   Eval      *IN71 = *ON
     C                   Write     Fmt1C
     C                   Eval      *IN71 = *OFF
     ?*
### On the second time through this loop when performing the read the MI 
gets MCH0601 at statment 43
     C                   Do        17            Rrn1
     C                   Read      Workfmt
     C                   Eval      *IN99 = %EOF
     C                   Write     Fmt1S
     C                   Move      'N'           Ctlfld                    
     n=read next
E001 C                   Enddo
     ?*
EDSR C                   Endsr
   

< ---- MI Code ---- >

/*********************************************************************/
/*  HELP TEXT EDITOR WORK SPACE HANDLER                              */
/*********************************************************************/

ENTRY      *(EXTPARM)   EXT;
DCL SPCPTR XRQS-SPP     PARM;
DCL SPCPTR XSTS-SPP     PARM;
DCL SPCPTR XERRCODE-SPP PARM;
DCL SPCPTR XIOAREA-SPP  PARM;
DCL SPCPTR XCTL-SPP     PARM;
DCL SPCPTR XFIRST-SPP   PARM;
DCL SPCPTR XCURRENT-SPP PARM;
DCL SPCPTR XSPCNAME-SPP PARM;
DCL SPCPTR XEOF-SPP     PARM;
DCL OL     EXTPARM(XRQS-SPP,XSTS-SPP,XERRCODE-SPP,XIOAREA-SPP,
                   XCTL-SPP,XFIRST-SPP,XCURRENT-SPP,XSPCNAME-SPP,
                   XEOF-SPP) PARM EXT;
DCL DD     XRQS         CHAR(1)   BAS(XRQS-SPP);
DCL DD     XSTS         CHAR(1)   BAS(XSTS-SPP);
DCL DD     XERRCODE     ZND(5,0)  BAS(XERRCODE-SPP);
DCL DD     XIOAREA      CHAR(67)  BAS(XIOAREA-SPP);
DCL DD     XCTL         CHAR(1)   BAS(XCTL-SPP);
DCL DD     XFIRST       PKD(15,0) BAS(XFIRST-SPP);
DCL DD     XCURRENT     PKD(15,0) BAS(XCURRENT-SPP);
DCL DD     XSPCNAME     CHAR(30)  BAS(XSPCNAME-SPP);
DCL DD     XEOF         CHAR(1)   BAS(XEOF-SPP);

/********************************************************************/
/*  START                                                           */
/********************************************************************/

           CMPBLA(B)    XRQS,'O'/EQ(OPEN);
           CMPBLA(B)    XRQS,'C'/EQ(CLOSE);
           CMPBLA(B)    XRQS,'R'/EQ(READ);
           CMPBLA(B)    XRQS,'W'/EQ(WRITE);

           CPYBLA       XSTS,'2';
           CPYNV        XERRCODE,90001;/* INVALID REQUEST */
           RTX          *;

/********************************************************************/
/*  OPEN FILE: RESOLVE WROK SPACE (CREATE IF NOT EXIST)             */
/********************************************************************/

DCL EXCM   EXCM1        EXCID(H'2201') BP(CRTSPACE) SKP;

OPEN:
           CMPBLA(B)    XCTL,' '/NEQ(OPENEND);

           RSLVSP       CTX-SYP,CTX-ID,*,X'FF00';
           CPYBLA       WRKSPC-NAME,XSPCNAME;
           MODEXCPD     EXCM1,*ENABLE,X'01';
           RSLVSP       WRKSPC-SYP,WRKSPC-ID,CTX-SYP,X'FF00';
           MODEXCPD     EXCM1,*DISABLE,X'01';
           SETSPPFP     WRKSPC-SPP,WRKSPC-SYP;
           CPYNV        XFIRST,WRKSPC-FIRST;
           CPYNV        XCURRENT,0;
           CPYBLA       XSTS,'0';
           CPYNV        XERRCODE,0;
OPENEND:   RTX          *;
CRTSPACE:
           MODEXCPD     EXCM1,*DISABLE,X'01';
           CPYBLA       SPCTMPL-NAME,XSPCNAME;
Stmt 43:   CRTS         WRKSPC-SYP,SPCTMPL-SPP;
           SETSPPFP     WRKSPC-SPP,WRKSPC-SYP;
           CPYNV        WRKSPC-FIRST,0;
           CPYNV        WRKSPC-COUNT,0;
           CPYNV        XFIRST,0;
           CPYNV        XCURRENT,0;
           CPYBLA       XSTS,'0';
           CPYNV        XERRCODE,0;
           RTX          *;

/********************************************************************/
/*  CLOSE FILE: DESTROY SPACE (IF REQUESTED)                        */
/********************************************************************/

CLOSE:
           CMPBLA(B)    XCTL,' '/NEQ(CLOSEEND);
           DESS         WRKSPC-SYP;
           DEACTPG      *;
CLOSEEND:  RTX          *;

/********************************************************************/
/*  READ FILE                                                       */
/********************************************************************/

DCL DD     CURRENT      BIN(4) AUTO;
DCL DD     OFFSET       BIN(4) AUTO;
DCL DD     FREE         CHAR(8) AUTO INIT(X'FFFFFFFFFFFFFFFF');

READ:
           CPYNV        CURRENT,XCURRENT;
           CPYBWP       RECORD-SPP,WRKSPC-SPP;
           SETSPPO      RECORD-SPP,CURRENT;

           CMPBLA(B)    XCTL,'P'/EQ(READPREV);
           CMPBLA(B)    XCTL,'N'/EQ(READNEXT);
           CMPBLA(B)    XCTL,'C'/EQ(READOK);
           CMPBLA(B)    XCTL,'E'/EQ(READEND);

           CPYBLA       XSTS,'2';
           CPYNV        XERRCODE,90002; /* INVALID READ REQUEST */
           RTX          *;

READPREV:
           CMPNV(B)     CURRENT,0/EQ(EOF);
           CMPNV(B)     RECORD-PREV,0/EQ(EOF);
           CPYNV        CURRENT,RECORD-PREV;
           SETSPPO      RECORD-SPP,CURRENT;
           B            READOK;

READNEXT:
           CMPNV(B)     WRKSPC-COUNT,0/EQ(ADDRECORD);
           CMPNV(B)     RECORD-NEXT,0/EQ(ADDRECORD);
           CMPNV(B)     CURRENT,0/HI(TAG1);
           CPYNV        CURRENT,WRKSPC-FIRST;
           B            TAG2;
TAG1:      CPYNV        CURRENT,RECORD-NEXT;
TAG2:      SETSPPO      RECORD-SPP,CURRENT;
           B            READOK;
ADDRECORD:
           CMPNV(B)     WRKSPC-COUNT,3000/EQ(EOF);
           CPYNV        PREV,0;
           CPYNV        NEXT,0;
           CMPNV(B)     CURRENT,0/EQ(END51);
           CPYNV        PREV,CURRENT;
           CPYNV        NEXT,RECORD-NEXT;
END51:

/* NEW RECORD */
           SEARCH       CURRENT,WRKSPC-PTR,FREE,1;
           MULT(S)      CURRENT,75;
           SUBN(S)      CURRENT,59;
           SETSPPO      RECORD-SPP,CURRENT;
           CPYNV        RECORD-PREV,PREV;
           CPYNV        RECORD-NEXT,NEXT;
           CPYBLAP      RECORD-DATA,' ',' ';
           CPYNV        WRKSPC-LAST,CURRENT;
           ADDN(S)      WRKSPC-COUNT,1;

/* PREVIOUS RECORD */
           CMPNV(B)     RECORD-PREV,0/EQ(END52);
           SETSPPO      RECORD-SPP,RECORD-PREV;
           CPYNV        RECORD-NEXT,CURRENT;
           SETSPPO      RECORD-SPP,CURRENT;
           B            END53;
END52:     CPYNV        WRKSPC-FIRST,CURRENT;
END53:     B            READOK;


READEND:
           CMPNV(B)     CURRENT,0/HI(CONT1);
           CMPNV(B)     WRKSPC-FIRST,0/EQ(EOF);
           CPYNV        CURRENT,WRKSPC-FIRST;
           B            CONT2;
CONT1:     CMPNV(B)     RECORD-NEXT,0/EQ(EOF);
           CPYNV        CURRENT,RECORD-NEXT;
CONT2:     SETSPPO      RECORD-SPP,CURRENT;
           CPYNV        OFFSET,CURRENT;
CF:        CMPBLAP(B)   RECORD-DATA,' ',' '/NEQ(ENDREADEND);
           CMPNV(B)     RECORD-NEXT,0/EQ(EOF);
           CPYNV        OFFSET,RECORD-NEXT;
           SETSPPO      RECORD-SPP,OFFSET;
           B            CF;
ENDREADEND:SETSPPO      RECORD-SPP,CURRENT;

READOK:
           CPYBLA       XIOAREA,RECORD-DATA;
           CPYNV        XFIRST,WRKSPC-FIRST;
           CPYNV        XCURRENT,CURRENT;
           CPYBLA       XSTS,'0';
           CPYNV        XERRCODE,0;
           RTX          *;


EOF:
           CPYBLA       XEOF,'1';
           CPYBLA       XSTS,'0';
           CPYNV        XERRCODE,0;
           RTX          *;

/********************************************************************/
/*  WRITE FILE                                                      */
/********************************************************************/

DCL DD     NEXT         BIN(4) AUTO;
DCL DD     PREV         BIN(4) AUTO;
DCL DD     BUFFER       CHAR(75) AUTO;

WRITE:
           CPYNV        CURRENT,XCURRENT;
           CPYBWP       RECORD-SPP,WRKSPC-SPP;
           SETSPPO      RECORD-SPP,CURRENT;

           CMPBLA(B)    XCTL,'B'/EQ(ADDBEFORE);
           CMPBLA(B)    XCTL,'A'/EQ(ADDAFTER);
           CMPBLA(B)    XCTL,'U'/EQ(UPDATE);
           CMPBLA(B)    XCTL,'D'/EQ(DELETE);

           CPYBLA       XSTS,'2';
           CPYNV        XERRCODE,90003; /* INVALID WRITE REQUEST */
           RTX          *;

ADDBEFORE:
           CPYNV        PREV,0;
           CPYNV        NEXT,0;
           CMPNV(B)     CURRENT,0/EQ(END01);
           CPYNV        PREV,RECORD-PREV;
           CPYNV        NEXT,CURRENT;
END01:

/* NEW RECORD */
           CMPNV(B)     WRKSPC-COUNT,3000/EQ(END02); /* SPACE FULL */
           SEARCH       CURRENT,WRKSPC-PTR,FREE,1;
           MULT(S)      CURRENT,75;
           SUBN(S)      CURRENT,59;
           SETSPPO      RECORD-SPP,CURRENT;
           CPYNV        RECORD-PREV,PREV;
           CPYNV        RECORD-NEXT,NEXT;
           CPYBLA       RECORD-DATA,XIOAREA;
           ADDN(S)      WRKSPC-COUNT,1;
           B            END03;
END02:     CPYNV        CURRENT,WRKSPC-LAST;
           SETSPPO      RECORD-SPP,CURRENT;
           CPYNV        WRKSPC-LAST,RECORD-PREV;
           SETSPPO      RECORD-SPP,RECORD-PREV;
           CPYNV        RECORD-NEXT,0;
           SETSPPO      RECORD-SPP,CURRENT;
           CPYNV        RECORD-PREV,PREV;
           CPYNV        RECORD-NEXT,NEXT;
           CPYBLA       RECORD-DATA,XIOAREA;
END03:

/* PREVIOUS RECORD */
           CMPNV(B)     RECORD-PREV,0/EQ(END04);
           SETSPPO      RECORD-SPP,RECORD-PREV;
           CPYNV        RECORD-NEXT,CURRENT;
           SETSPPO      RECORD-SPP,CURRENT;
           B            END05;
END04:     CPYNV        WRKSPC-FIRST,CURRENT;
END05:

/* NEXT RECORD     */
           CMPNV(B)     RECORD-NEXT,0/EQ(END06);
           SETSPPO      RECORD-SPP,RECORD-NEXT;
           CPYNV        RECORD-PREV,CURRENT;
           SETSPPO      RECORD-SPP,CURRENT;
           B            END07;
END06:     CPYNV        WRKSPC-LAST,CURRENT;
END07:
           CPYNV        XFIRST,WRKSPC-FIRST;
           CPYNV        XCURRENT,CURRENT;
           CPYBLA       XSTS,'0';
           CPYNV        XERRCODE,0;
           RTX          *;


ADDAFTER:
           CPYNV        PREV,0;
           CPYNV        NEXT,WRKSPC-FIRST;
           CMPNV(B)     CURRENT,0/EQ(END21);
           CPYNV        PREV,CURRENT;
           CPYNV        NEXT,RECORD-NEXT;
END21:

/* NEW RECORD */
           CMPNV(B)     WRKSPC-COUNT,3000/EQ(END22); /* SPACE FULL */
           SEARCH       CURRENT,WRKSPC-PTR,FREE,1;
           MULT(S)      CURRENT,75;
           SUBN(S)      CURRENT,59;
           SETSPPO      RECORD-SPP,CURRENT;
           CPYNV        RECORD-PREV,PREV;
           CPYNV        RECORD-NEXT,NEXT;
           CPYBLA       RECORD-DATA,XIOAREA;
           ADDN(S)      WRKSPC-COUNT,1;
           B            END23;
END22:     CPYNV        CURRENT,WRKSPC-LAST;
           SETSPPO      RECORD-SPP,CURRENT;
           CPYNV        WRKSPC-LAST,RECORD-PREV;
           SETSPPO      RECORD-SPP,RECORD-PREV;
           CPYNV        RECORD-NEXT,0;
           SETSPPO      RECORD-SPP,CURRENT;
           CPYNV        RECORD-PREV,PREV;
           CPYNV        RECORD-NEXT,NEXT;
           CPYBLA       RECORD-DATA,XIOAREA;
END23:

/* PREVIOUS RECORD */
           CMPNV(B)     RECORD-PREV,0/EQ(END24);
           SETSPPO      RECORD-SPP,RECORD-PREV;
           CPYNV        RECORD-NEXT,CURRENT;
           SETSPPO      RECORD-SPP,CURRENT;
           B            END25;
END24:     CPYNV        WRKSPC-FIRST,CURRENT;
END25:

/* NEXT RECORD     */
           CMPNV(B)     RECORD-NEXT,0/EQ(END26);
           SETSPPO      RECORD-SPP,RECORD-NEXT;
           CPYNV        RECORD-PREV,CURRENT;
           SETSPPO      RECORD-SPP,CURRENT;
           B            END27;
END26:     CPYNV        WRKSPC-LAST,CURRENT;
END27:
           CPYNV        XFIRST,WRKSPC-FIRST;
           CPYNV        XCURRENT,CURRENT;
           CPYBLA       XSTS,'0';
           CPYNV        XERRCODE,0;
           RTX          *;


UPDATE:
           CPYBLA       RECORD-DATA,XIOAREA;
           CPYNV        XFIRST,WRKSPC-FIRST;
           CPYNV        XCURRENT,CURRENT;
           CPYBLA       XSTS,'0';
           CPYNV        XERRCODE,0;
           RTX          *;


DELETE:
           CPYNV        PREV,RECORD-PREV;
           CPYNV        NEXT,RECORD-NEXT;

           CMPNV(B)     PREV,0/EQ(END41);
           SETSPPO      RECORD-SPP,PREV;
           CPYNV        RECORD-NEXT,NEXT;
           B            END42;
END41:     CPYNV        WRKSPC-FIRST,NEXT;
END42:
           CMPNV(B)     NEXT,0/EQ(END43);
           SETSPPO      RECORD-SPP,NEXT;
           CPYNV        RECORD-PREV,PREV;
           B            END44;
END43:     CPYNV        WRKSPC-LAST,PREV;
END44:
           SUBN(S)      WRKSPC-COUNT,1;

           SETSPPO      RECORD-SPP,CURRENT;
           CPYBLAP      RECORD-BUFF,X'FFFFFFFFFFFFFFFF',X'00';

           CPYNV        CURRENT,NEXT;
           SETSPPO      RECORD-SPP,CURRENT;

           CPYNV        XFIRST,WRKSPC-FIRST;
           CPYNV        XCURRENT,CURRENT;
           CPYBLA       XSTS,'0';
           CPYNV        XERRCODE,0;
           RTX          *;

/********************************************************************/

DCL SYSPTR WRKSPC-SYP;
DCL SPCPTR WRKSPC-SPP;
DCL DD     WRKSPC-FIRST BIN(4)  BAS(WRKSPC-SPP) POS(1);   /* FIRST LINE */
DCL DD     WRKSPC-LAST  BIN(4)  BAS(WRKSPC-SPP) POS(5); /* LAST LINE  */
DCL DD     WRKSPC-COUNT BIN(4)  BAS(WRKSPC-SPP) POS(13); /* LINE COUNT */
DCL DD     WRKSPC-DUMMY CHAR(1) BAS(WRKSPC-SPP) POS(17);
DCL DD     WRKSPC-PTR(3000) CHAR(8) DEF(WRKSPC-DUMMY) AEO(75);

DCL SPCPTR RECORD-SPP   AUTO;
DCL DD     RECORD-PREV  BIN(4)   BAS(RECORD-SPP) POS(1); /* PREV LINE */
DCL DD     RECORD-NEXT  BIN(4)   BAS(RECORD-SPP) POS(5); /* NEXT LINE */
DCL DD     RECORD-DATA  CHAR(67) BAS(RECORD-SPP) POS(9); /* DATA      */
DCL DD     RECORD-BUFF  CHAR(75) BAS(RECORD-SPP) POS(1);

DCL SPCPTR SPCTMPL-SPP  AUTO INIT(SPCTMPL);
DCL DD     SPCTMPL      CHAR(160) AUTO;
DCL DD     *            BIN(4)   DEF(SPCTMPL) POS(1)  INIT(160);
DCL DD     *            CHAR(2)  DEF(SPCTMPL) POS(9)  INIT(X'19EE');
DCL DD     SPCTMPL-NAME CHAR(30) DEF(SPCTMPL) POS(11);
DCL DD     *            CHAR(4)  DEF(SPCTMPL) POS(41) INIT(X'E2000000');
DCL DD     *            CHAR(4)  DEF(SPCTMPL) POS(45) INIT(X'00000000');
/*   DCL DD     *            BIN(4)   DEF(SPCTMPL) POS(49) INIT(127516); 
*/
     DCL DD     *            BIN(4)   DEF(SPCTMPL) POS(49) INIT(225016);
DCL DD     *            CHAR(1)  DEF(SPCTMPL) POS(53) INIT(X'FF');
DCL DD     *            CHAR(4)  DEF(SPCTMPL) POS(54) INIT(X'03000000');
DCL DD     *            CHAR(1)  DEF(SPCTMPL) POS(58) INIT(X'00');
DCL DD     *            CHAR(2)  DEF(SPCTMPL) POS(59) INIT(X'FF00');
DCL DD     *            BIN(4)   DEF(SPCTMPL) POS(61) INIT(0);
DCL SYSPTR CTX-SYP               DEF(SPCTMPL) POS(65);

DCL DD     WRKSPC-ID    CHAR(34) AUTO;
DCL DD     *            CHAR(2)  DEF(WRKSPC-ID) POS(1)  INIT(X'19EE');
DCL DD     WRKSPC-NAME  CHAR(30) DEF(WRKSPC-ID) POS(3);
DCL DD     *            CHAR(2)  DEF(WRKSPC-ID) POS(33) INIT(X'0000');

DCL DD     CTX-ID       CHAR(34) AUTO;
DCL DD     *            CHAR(2)  DEF(CTX-ID) POS(1)  INIT(X'0401');
DCL DD     *            CHAR(30) DEF(CTX-ID) POS(3)  INIT('QRECOVERY');
DCL DD     *            CHAR(2)  DEF(CTX-ID) POS(33) INIT(X'0000');

DCL CON    *ENABLE      CHAR(2) INIT(X'A000');
DCL CON    *DISABLE     CHAR(2) INIT(X'2000');
           PEND; 

 


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.