Problem in SEU User Defined Command Processing Program

40 pts.
Tags:
SEU
SEU Editor
Hi, I am facing a unique problem while executing a user defined line command processor pgm for SEU. On F8, the program again executes STRSEU command to open another SEU source. On pressing F3 on the second source, deletes the QTEMP/QSUSPC user space object. Due to this the pointer values are lost when control returns back to the program resulting into error: Statement/Instruction . . . . . . . . . : /041E Program . . . . . . . . . . . . . . . . : QSUUSRLC Recursion level . . . . . . . . . . . . : 1 Tried to refer to all or part of an object that no longer exists. There are two ways to prevent this: 1) Prevent the deletion of QTEMP/QSUSPC when exiting from the second SEU source 2) Backup and Restore the Userspace after exiting from the second SEU source but at the same memory location(which is again a challenge). Wanted to know if any of the two ways can be implemented and if yes then how? The source Code for trial is as below:

h dftactgrp(*no) actgrp(*NEW) indent(*none)              //SEU InPut                                          D SEUInput        DS                  BASED(SEUInputP) D  StmtLength                   10i 0                  D  CurRec                       10i 0                  D  CurCol                       10i 0                  D  CCSID                        10i 0                  D  InputRecords                 10i 0                  D  SrcMbr                       10                     D  SrcFil                       10                     D  SrcLib                       10                     D  MbrType                      10                     D  FnKey                         1                     D  SEUMode                       1                     D  SplitSession                  1                     D  ReservedInp                   1                       //SEU OutPut                                         D SEUOutput       DS                  BASED(SEUOutputP) D  ReturnCode                    1                     D  ReservedOut1                  3                       D  OutputRecords                10i 0                    D  InsertedSeq                   7                       D  ReservedOut2                 21                         //Source statements.                                   D SEUSource       DS                  BASED(SEUSourceP)  D  LineCmd                       7                       D  LineRetCode                   1                       D  SourceSeq                     6                       D  SourceDate                    6                       D  SourceStmt                  256                        * API error structure                                   D ErrStruc        DS                  inz                D  ErrSSize                     10i 0 inz(%len(ErrStruc)) D  ErrSUse                      10i 0                    D  ErrSMsgID                     7                       D  ErrSResrv                     1                       D  ErrSData                     80                       DCmdString        S           2000A                        //Execute CL command                                 DExecmd           PR              N                           d                             2000A   Const                   d                               96A                           DSEUInputPParm    S               *                           DSEUOutputPParm   S               *                           DSEUSourcePParm   S               *                           C     *Entry        PLIST                                     C                   PARM                    SEUInputPParm     C                   PARM                    SEUOutputPParm    C                   PARM                    SEUSourcePParm    C                                                              /Free                                                          SEUInputP    = SEUInputPParm;                                 SEUOutputP   = SEUOutputPParm;                                If FnKey = '8';                                               CmdString =                                                   'STRSEU SRCFILE(QTEMP/SEUQMQRY) SRCMBR(SEUQMQRY) OPTION(5)';   CmdString = 'CALL PGM(STRSEUCLP)';                            CallP ExeCmd(CmdString:ErrStruc);                             EndIf;                                                        *InLr = *On;                                                       /End-Free                                                            //================================================================   //Execute CL command with QCAPCMD API                               //================================================================ PExecmd           b                                                 DExecmd           PI              N                                 dcmdString                    2000A   Const                         dErrorDS                        96A                                   //Prototype for QCAPCMD API                                       DExecuteCommand   PR                  EXTPGM('QCAPCMD')             D                             2000A                                 D                               10i 0                               D                               41A                                 D                               10i 0                               D                                8                                  D                                1                                  D                               10i 0                               D                               10i 0                               D                               96A                                   //Parameters for QCAPCMD API                                  dcommand          s           2000A                             dcmdlng           s             10i 0                           docb              ds                                            d type                          10i 0 inz(0)                    d DBCSdh                         1    inz('0')                  d prompt                         1    inz('0')                  d cmdsyntax                      1    inz('0')                  d msgrtvkey                      4    inz(x'00000000')          d reserve1                       9    inz(x'000000000000000000') docblength                      10i 0 inz(x'00000014')          docbfmt                          8    inz('CPOP0100')           dchgcmd                          1    inz(' ')                  dlngchgcmd                      10i 0 inz(0)                    dlngchgrtn                      10i 0 inz(0)                      //API Error Data Structure                                    D ErrStruc        DS                  inz                       D  ErrSSize                     10i 0 inz(%len(ErrStruc))       D  ErrSUse                      10i 0                           D  ErrSMsgID                     7                              D  ErrSResrv                     1                          D  ErrSData                     80                           /Free                                                        //API Error Data Structure                                  command = cmdString;                                        cmdlng  = %Len(%trim(command));                             callp  executecommand(command:cmdlng:ocb:ocblength:ocbfmt:                 chgcmd:lngchgcmd:lngchgrtn:ErrStruc);         If ErrSUse >  0;                                            //Dsply   ErrSMsgID;                                        ErrorDs = ErrStruc;                                         Return *On;                                                 Else;                                                       Return *Off;                                                EndIf;                                                     /End-Free                                                  PExecmd           e      

Answer Wiki

Thanks. We'll let you know when a new response is added.

Here is the code in proper format….

<pre>
The source Code for trial is as below:
h dftactgrp(*no) actgrp(*NEW) indent(*none)
//SEU InPut
D SEUInput DS BASED(SEUInputP)
D StmtLength 10i 0
D CurRec 10i 0
D CurCol 10i 0
D CCSID 10i 0
D InputRecords 10i 0
D SrcMbr 10
D SrcFil 10
D SrcLib 10
D MbrType 10
D FnKey 1
D SEUMode 1
D SplitSession 1
D ReservedInp 1
//SEU OutPut
D SEUOutput DS BASED(SEUOutputP)
D ReturnCode 1
D ReservedOut1 3
D OutputRecords 10i 0
D InsertedSeq 7
D ReservedOut2 21
//Source statements.
D SEUSource DS BASED(SEUSourceP)
D LineCmd 7
D LineRetCode 1
D SourceSeq 6
D SourceDate 6
D SourceStmt 256
* API error structure
D ErrStruc DS inz
D ErrSSize 10i 0 inz(%len(ErrStruc))
D ErrSUse 10i 0
D ErrSMsgID 7
D ErrSResrv 1
D ErrSData 80
DCmdString S 2000A
//Execute CL command DExecmd PR N
d 2000A Const
d 96A
DSEUInputPParm S *
DSEUOutputPParm S *
DSEUSourcePParm S *
C *Entry PLIST
C PARM SEUInputPParm
C PARM SEUOutputPParm
C PARM SEUSourcePParm
C
/Free
SEUInputP = SEUInputPParm;
SEUOutputP = SEUOutputPParm;
If FnKey = ’8′;
CmdString =
‘STRSEU SRCFILE(QTEMP/SEUQMQRY) SRCMBR(SEUQMQRY) OPTION(5)’;
CmdString = ‘CALL PGM(STRSEUCLP)’;
CallP ExeCmd(CmdString:ErrStruc);
EndIf;
*InLr = *On;
/End-Free
//================================================================
//Execute CL command with QCAPCMD API
//================================================================
PExecmd b
DExecmd PI N
dcmdString 2000A Const
dErrorDS 96A
//Prototype for QCAPCMD API
DExecuteCommand PR EXTPGM(‘QCAPCMD’)
D 2000A
D 10i 0
D 41A
D 10i 0
D 8
D 1
D 10i 0
D 10i 0
D 96A
//Parameters for QCAPCMD API
dcommand s 2000A
dcmdlng s 10i 0
docb ds
d type 10i 0 inz(0)
d DBCSdh 1 inz(’0′)
d prompt 1 inz(’0′)
d cmdsyntax 1 inz(’0′)
d msgrtvkey 4 inz(x’00000000′)
d reserve1 9 inz(x’000000000000000000′)
docblength 10i 0 inz(x’00000014′)
docbfmt 8 inz(‘CPOP0100′)
dchgcmd 1 inz(‘ ‘)
dlngchgcmd 10i 0 inz(0)
dlngchgrtn 10i 0 inz(0)
//API Error Data Structure
D ErrStruc DS inz
D ErrSSize 10i 0 inz(%len(ErrStruc))
D ErrSUse 10i 0
D ErrSMsgID 7
D ErrSResrv 1
D ErrSData 80
/Free
//API Error Data Structure
command = cmdString;
cmdlng = %Len(%trim(command));
callp executecommand(command:cmdlng:ocb:ocblength:ocbfmt:
chgcmd:lngchgcmd:lngchgrtn:ErrStruc);
If ErrSUse > 0;
//Dsply ErrSMsgID;
ErrorDs = ErrStruc;
Return *On;
Else;
Return *Off;
EndIf;
/End-Free
PExecmd e
</pre>

Discuss This Question: 10  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • mjaybharat
    The source Code for trial is as below:
    h dftactgrp(*no) actgrp(*NEW) indent(*none)            
      //SEU InPut                                          
    D SEUInput        DS                  BASED(SEUInputP) 
    D  StmtLength                   10i 0                  
    D  CurRec                       10i 0                  
    D  CurCol                       10i 0                  
    D  CCSID                        10i 0                  
    D  InputRecords                 10i 0                  
    D  SrcMbr                       10                     
    D  SrcFil                       10                     
    D  SrcLib                       10                     
    D  MbrType                      10                     
    D  FnKey                         1                     
    D  SEUMode                       1                     
    D  SplitSession                  1                     
    D  ReservedInp                   1                     
      //SEU OutPut                                         
    D SEUOutput       DS                  BASED(SEUOutputP)
    D  ReturnCode                    1                     
    D  ReservedOut1                  3                       
    D  OutputRecords                10i 0                    
    D  InsertedSeq                   7                       
    D  ReservedOut2                 21                       
      //Source statements.                                   
    D SEUSource       DS                  BASED(SEUSourceP)  
    D  LineCmd                       7                       
    D  LineRetCode                   1                       
    D  SourceSeq                     6                       
    D  SourceDate                    6                       
    D  SourceStmt                  256                       
     * API error structure                                   
    D ErrStruc        DS                  inz                
    D  ErrSSize                     10i 0 inz(%len(ErrStruc))
    D  ErrSUse                      10i 0                    
    D  ErrSMsgID                     7                       
    D  ErrSResrv                     1                       
    D  ErrSData                     80                       
    DCmdString        S           2000A                      
      //Execute CL command                                 DExecmd           PR              N                           
    d                             2000A   Const                   
    d                               96A                           
    DSEUInputPParm    S               *                           
    DSEUOutputPParm   S               *                           
    DSEUSourcePParm   S               *                           
    C     *Entry        PLIST                                     
    C                   PARM                    SEUInputPParm     
    C                   PARM                    SEUOutputPParm    
    C                   PARM                    SEUSourcePParm    
    C                                                             
     /Free                                                        
      SEUInputP    = SEUInputPParm;                               
      SEUOutputP   = SEUOutputPParm;                              
      If FnKey = '8';                                             
      CmdString =                                                 
      'STRSEU SRCFILE(QTEMP/SEUQMQRY) SRCMBR(SEUQMQRY) OPTION(5)';
      CmdString = 'CALL PGM(STRSEUCLP)';                          
      CallP ExeCmd(CmdString:ErrStruc);                           
      EndIf;                                                      
      *InLr = *On;                                                      
     /End-Free                                                          
      //================================================================
      //Execute CL command with QCAPCMD API                             
      //================================================================
    PExecmd           b                                                 
    DExecmd           PI              N                                 
    dcmdString                    2000A   Const                         
    dErrorDS                        96A                                 
      //Prototype for QCAPCMD API                                       
    DExecuteCommand   PR                  EXTPGM('QCAPCMD')             
    D                             2000A                                 
    D                               10i 0                               
    D                               41A                                 
    D                               10i 0                               
    D                                8                                  
    D                                1                                  
    D                               10i 0                               
    D                               10i 0                               
    D                               96A                                 
      //Parameters for QCAPCMD API                                  
    dcommand          s           2000A                             
    dcmdlng           s             10i 0                           
    docb              ds                                            
    d type                          10i 0 inz(0)                    
    d DBCSdh                         1    inz('0')                  
    d prompt                         1    inz('0')                  
    d cmdsyntax                      1    inz('0')                  
    d msgrtvkey                      4    inz(x'00000000')          
    d reserve1                       9    inz(x'000000000000000000')
    docblength                      10i 0 inz(x'00000014')          
    docbfmt                          8    inz('CPOP0100')           
    dchgcmd                          1    inz(' ')                  
    dlngchgcmd                      10i 0 inz(0)                    
    dlngchgrtn                      10i 0 inz(0)                    
      //API Error Data Structure                                    
    D ErrStruc        DS                  inz                       
    D  ErrSSize                     10i 0 inz(%len(ErrStruc))       
    D  ErrSUse                      10i 0                           
    D  ErrSMsgID                     7                              
    D  ErrSResrv                     1                          
    D  ErrSData                     80                          
     /Free                                                      
      //API Error Data Structure                                
      command = cmdString;                                      
      cmdlng  = %Len(%trim(command));                           
      callp  executecommand(command:cmdlng:ocb:ocblength:ocbfmt:
                    chgcmd:lngchgcmd:lngchgrtn:ErrStruc);       
      If ErrSUse >  0;                                          
      //Dsply   ErrSMsgID;                                      
      ErrorDs = ErrStruc;                                       
      Return *On;                                               
      Else;                                                     
      Return *Off;                                              
      EndIf;                                                    
     /End-Free                                                  
    PExecmd           e               
    40 pointsBadges:
    report
  • TomLiotta
    Well, yeah. That's what happens when you try to run SEU recursively in the same session -- it regenerates its work areas. Further, if you're going to have a program called recursively, you have to write it in a language that supports recursion and with techniques that support it. You might try compiling your ILE RPG program to run in ACTGRP(*NEW) for example. And when <F8> is pressed, save the SEU work areas in a temporary storage space that you maintain. Upon return from the F8 function, restore the SEU work space. You will need to keep track of different levels of recursion so that you don't lose track of which SEU work space you are saving or restoring. Perhaps you could push an identifier onto a queue and pop it off each time you return. Or you might use a service program that runs in a different named ACTGRP() and that holds the state information in memory. Tom
    125,585 pointsBadges:
    report
  • Sloopy
    May I ask, why do you want to display another souce member in SEU in this way? Why not use the method already available, to show another source member in the bottom half of the screen? Or are you using SEU for something it was not really designed for - such as a way to display help text? I don't think that saving and restoring the user space is going to help. And of course, restoring it to the same place in memory, while it could be done, is not guaranteed to work properly. At the least, between the deletion of the object and the recreation of the stored version, that freed memory can be reused by another job, or even by the program you invoke to restore the old object. I suspect that whatever you are actually trying to achieve can be done more easily and effectively another way - for the life of me, I can't see why this function would be of use in SEU. Sloopy
    2,195 pointsBadges:
    report
  • TomLiotta
    I don’t think that saving and restoring the user space is going to help. And of course, restoring it to the same place in memory, while it could be done, is not guaranteed to work properly. Good point. The exit program might be allowed to RNMOBJ the SEU user space before the lower level is invoked. The new invocation of SEU shouldn't recognize a renamed QSUSPC and therefore wouldn't delete/recreate it, thereby preserving pointers. Upon return to the higher level exit program, the new QSUSPC could probably be safely deleted and the original name restored. There may be many ways of getting it done. Regardless, a description of why the procedure is needed would probably be helpful. Tom
    125,585 pointsBadges:
    report
  • mjaybharat
    Thanks Tom. Your solution to rename and restore the object worked. To answer your question about why such a procedure is required is described as below: I was just trying to device a new methodology to save time during analysis of say a huge CL program. While analysing these programs you may want to check a part of the code without exiting SEU (where you are analysing). You just select few lines into a temporary source created in QTEMP. Press F8 to open this temporary source, edit is as required & press F8 again to compile & debug that part of code. My problem was, I was able to go into the temporary source, compile & debug code on pressing F8 in the temporary source....but I was getting an error when returning from this temporary source using F3 as stated in my original question. Also this is not the only case...we can use it for variety of other similar purposes as well... Hope this explains the whole story. Please let me know your comment on this unique usage and about its pros & cons. Regards, Jay.
    40 pointsBadges:
    report
  • Sandeep090485
    Hi !! im facing some problem like ( the instruction at "0x5ad71531" referenced memory at "0x00000014" the memory could not be "read"
    10 pointsBadges:
    report
  • Subhendu Sen
    Dear Sandeep090485, U have to create a new question under Ask a Question tag. It helps to view all respected members and u may get more helpful answers !
    29,210 pointsBadges:
    report
  • TomLiotta
    im facing some problem like ( the instruction at “0×5ad71531″ referenced memory at “0×00000014″ the memory could not be “read” The previous suggestion to open a new question is a good idea. When you do that, include the message identifier which is usually more important than the text. Also include a description of your program was doing when the error occurred. Tom
    125,585 pointsBadges:
    report
  • carlosdl
    I agree. However, I'm still wondering why this was posted in this thread as it seems to be a Windows error message.
    69,920 pointsBadges:
    report
  • TomLiotta
    I can't quite be sure if it's a Windows error or not. Hex addressing works in i5/OS too and similar messages may be signaled. Uncertainty is particularly because of the "some problem like" phrasing that implies a not quite precise wording. A SEU exit program could easily run into the problem although it might have a somewhat different message text. (Or not, especially if it was running a PASE (AIX) function.) Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following