Link to home
Start Free TrialLog in
Avatar of Theo Kouwenhoven
Theo KouwenhovenFlag for Netherlands

asked on

Variable line number SLNO(Y *VAR)

Hi All,

After all the years of programming I finally fond a reason to try the following with ther SLNO option in my DDS, but how to continue in RPGLE?

(every DDS record has (to try) 1 text and 1 Field (I/O) eg  Text-1: _______)
I will try to get the next thing working:

Eval  #SLN = 5
Write FMT01
Eval  #SLN = #SLN + 1
Write FMT02
Eval  #SLN = #SLN + 1
Write FMT03
Eval  #SLN = #SLN + 1
Read WSTN

Result:

Text-1: _______
Text-2: ____0,00_
Text-3: _______________________

But on read only value of Text-3 is available (of course).
Is there anything I can do get this working?
(Subfile is no option)

Regards,

Murphey
Avatar of daveslater
daveslater
Flag of United States of America image

Hi Murph

Are you still working on this?

I might have a sort of solution

Dave
Avatar of Theo Kouwenhoven

ASKER

Hi Dave,

I'm not surprised that it's you again, I solved it more or less (a not so nice workaround) but please let me know the solution you found
Hi
I would use the
"QsnReadScr" & "QsnRtvDta" API's to read the input buffer.
This returns a 1920 byte field; calculate the position of the data in the string and sub string it out

Dave
Hi
API example to get the screen

 ********************************************************              
 ** Create input buffe                                                
D CrtInpBuf       PR                  extproc( 'QsnCrtInpBuf')        
D   Len                         10I 0 Const                            
D   Inc                         10I 0 Const                            
D   Max                         10I 0 Const                            
D   Buffer                      10I 0                                  
D   Error                       10I 0 Const                            
 ********************************************************              
 ** delete buffer                                                      
D DltBuf          PR                  extproc( 'QsnDltBuf')            
D   Buffer                      10I 0                                  
D   Error                       10I 0 Const                            
 ********************************************************              
 ** Clear buffer                                                      
D ClrBuf          PR                  extproc( 'QsnClrBuf')            
D   Buffer                      10I 0 Const                            
D   ErrorCode                   10I 0 Const                            
********************************************************                
** Read screen                                                          
 ReadScreen      PR                  extproc( 'QsnReadScr')              
   Length                      10I 0                                    
   Inp                         10I 0                                    
   CmdBuffer                   10I 0 Const                              
   Env                         10I 0 Const                              
   Error                       10I 0 Const                              
********************************************************                
** Read immediate - alll input fields                                    
 RtvDta          PR                  extproc( 'QsnRtvDta')              
   Inp                         10I 0                                    
   Ptr                           *                                      
   Error                       10I 0 Const                              
********************************************************                                          
 Env             S             10I 0                                    
 Inp             S             10I 0                                    
 Length          S             10I 0                                    
 Data            S           1920A   based(Ptr)                          
  **                                                                            
 C                   Callp     CrtInpBuf(1920 : 0 : 0 : Inp : 0 )                
 C                   Callp     ClrBuf(Inp : 0 )                                  
 C                   Callp     ReadScreen(Length : Inp : 0 : Env : 0 )          
 C                   Callp     RtvDta(Inp : Ptr : 0 )                            
 C                   Callp     DltBuf(Inp : 0 )                                  
 C                   Eval      *INLR = *on                                      


Dave

Ps

There is a function tha reads input fields but I am not sure if it only reds the active screen
Hi Dave,

I will lok to this, but probably not for end of December...

Thanks till now.
Avatar of SuperCCA
SuperCCA

If you want a greater level of control then I suggest you move to user defined data streams. It's a little tricky to get started but give absolute control of the display area. Let me know if you need more.
Hi SuperCCA,

Yes I need more, that is (I hope) also the solusion to display fields with variable length!!

Let me know as much as possible.
You can do whatever you like but equally you have to do all display handling. First off you will need a copy of the 54594 Remote Control Unit Functions Reference manual SC30-3533-04. I know it sounds unlikely but this where the 5250 data stream is documented. If you get moving on this then I will try and post some 'get you started' code later.

Cheers
I found the following :
----------------------------------------------------------
5494 Remote Control Unit
Functions Reference
Release 3.1
Document Number SC30-3533-04
Part Number 38H6893

This must be the one !!! If this is what I think it is.... I will put a new question for you with more points to earn.
I'm not fussed about points - I was on the site by accident and thought I'd help. Where would like the code posted?
I don't know how much code it is....
you can copy and paste it to this site,
but if it is to much to paste please send it to murphey2@hotmail.com

You will need the following DDS (note that FORMAT01 will not be used
but creates the necessary buffer space). Let's call it DSP5250

     A                                      DSPSIZ(24 80 *DS3)      
     A          R FORMAT01                  KEEP                    
     A            DATA       32763   H                                          
      *                                                            
     A          R FORMATREC                 INVITE KEEP            
     A                                      PRINT                  
     A                                      USRDFN                  

ILERPG specifications

FDSP5250   CF   F32763        WORKSTN            
F                                     PASS(*NOIND)
                                                 
D Hex             S              1    DIM(255)    
 *                                                
D                 DS                              
D  @Q                     1      4B 0            
D  @sHex                  3      4                
D                 DS                              
D  @X                     1      2  0            
D  @sX                    1      2                
 *                                                
D UsrDta          DS                              
D  @sPutLen               1      2B 0            
D  @sGetLen               3      4B 0            
D  @sFunction             5      5                          
 *                                                      
D @pDS5250        DS                                    
D  Arr                    1  32758    DIM(32758)        
 *                                                      
 * Work Fields                                          
 *                                                      
D*@x              S              2  0                    
 *                                                      
 * Internal Input Specifications                        
 *                                                      
IDSP5250   NS                                            
I                                  132758  @pDS5250      
 *                                                      
 * Build Hex Values Array                                
 *                                                      
C     1             Do        255           @Q          
C                   Move      @sHex         Hex(@Q)      
C                   Enddo                                          
 *                                                                  
 * Build Data Stream                                                
 *                                                                  
C                   Eval      @pDS5250 =                            
 * Clear Display                                                    
C                             x'0440' +                            
 * Write to display                                                
C                             x'04112008' +                        
 * Screen Title (SBA,Att,Data,Att)                                  
C                             x'11012222' + 'Play with 5250' + x'20'
 *                                                                  
 * 10 lines of text and varying length fields                      
 *                                                                  
C                   For       @x = 5 to 14                          
C                   Eval      @pDS5250 = %Trim(@pDS5250) +          
 * SBA,Row,Column                                                  
C                             x'11' + Hex(@x) + x'05' +      
 * Data                                                      
C                             x'20' + 'Text ' + @sX + x'20' +
 * SBA,Row,Column                                            
C                             x'11' + Hex(@x) + x'14' +      
 * Start of field                                            
C                             x'1D40002400' + Hex(@x)        
C                   Endfor                                  
 *                                                          
 * Set control data                                          
 *                                                          
C     ' '           Checkr    @pDS5250      @sPutLen        
C                   Eval      @sGetLen = 300                
C                   Eval      @sFunction = x'73'            
 *                                                          
 * Send to display                                          
 *                                                          
C                   Except    DSPREC                      
C                   Read      DSP5250                      
 *                                                        
 * End of program                                          
 *                                                        
C                   Eval      *inlr = *on                  
 *                                                        
 * Internal Output specifications                          
 *                                                        
ODSP5250   E            DSPREC                            
O                                           K9 'FORMATREC'
O                       USRDTA               5            
O                       @pDS5250         32763            


Enjoy!!!

(PS watch yourself if you introduce other 5250 orders, one mistake can crash your emulation session and under some circumstances no 5250 session will be usable until reboot.
Hee SuperCCA,

This is really great, Can I do the same trick with Subfile programs????
ASKER CERTIFIED SOLUTION
Avatar of SuperCCA
SuperCCA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial