Solved

Variable line number SLNO(Y *VAR)

Posted on 2003-11-20
14
649 Views
Last Modified: 2008-01-16
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
0
Comment
Question by:theo kouwenhoven
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
14 Comments
 
LVL 14

Expert Comment

by:daveslater
ID: 9838405
Hi Murph

Are you still working on this?

I might have a sort of solution

Dave
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 9843232
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
0
 
LVL 14

Expert Comment

by:daveslater
ID: 9849075
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
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 14

Expert Comment

by:daveslater
ID: 9849591
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
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 9849863
Hi Dave,

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

Thanks till now.
0
 
LVL 1

Expert Comment

by:SuperCCA
ID: 10494113
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.
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 10494350
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.
0
 
LVL 1

Expert Comment

by:SuperCCA
ID: 10494405
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
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 10495137
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.
0
 
LVL 1

Expert Comment

by:SuperCCA
ID: 10495216
I'm not fussed about points - I was on the site by accident and thought I'd help. Where would like the code posted?
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 10495412
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

0
 
LVL 1

Expert Comment

by:SuperCCA
ID: 10497040
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.
0
 
LVL 16

Author Comment

by:theo kouwenhoven
ID: 10504164
Hee SuperCCA,

This is really great, Can I do the same trick with Subfile programs????
0
 
LVL 1

Accepted Solution

by:
SuperCCA earned 100 total points
ID: 10504272
The short answer is no.

You are now operating below OS/400 display management and ALL functionality must be provided by yourself.

The longer answer is yes.

If you take responsibility for the Page Up/Down AID keys then you can provide all the capabilities of a Sfl but you do need to work harder.

Also if you want to access the data keyed into the input fields you will need to put a Read MDT command on the end of the string - x'0442' from memory.

Cheers
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In order to fulfill our mission of inspiring learning in the technology community, Experts Exchange is launching a Course of the Month program. Premium and Team Account members will have access to one course per month as a part of their membership, …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question