how to display blank rows in a subfile in rpgle

130 pts.
Tags:
RPGLE
SFLRNA
i have a subfile with sflpag=sflsiz=10. say in PF total records are 25.

when in load subfile in 3rd page i see only 5 records.But my requirement is to see 5 records from PF & 5 blank rows.

I tried to do it using sflinz and sflrna.I used a indicator with sflinz.when writing SFLCTL i am switching INZ = on and switch off after writing sflctl, but when running the pgm i am getting 'Session or device error'.Please help.

Does any one have exact syntax of dspf and rpgle code for this.



Software/Hardware used:
as400

Answer Wiki

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

Discuss This Question: 5  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
  • deepu9321
    I havent tried the similar case. But, A guess, While loading the records to Subfile, In 3rd Iteration(20 - 30), You might be having a condition to Write the Records until EOF. Have you tried to Repeat the Loop to write the Blank Records till RRN becomes 30. Something like,
    /Free
          Dow RecCnt <= 10 ;
                  If %EOF() ;
                     Move Blanks ; //Blanks to Subfile Fields
                  Else ;
                     Move PFData ; //Write Records from PF
                  EndIF ;
                  RecCnt = RecCnt + 1 ;
                  RRN = RRN + 1 ;
           EndDo ;
    /End-Free
    
    All the other Operations including SFLEND, PAGEDOWN will be handled in a similar way. Pradeep.
    3,650 pointsBadges:
    report
  • TomLiotta
    It's an odd requirement. I assume it's a learning exercise. Pradeep's suggestion seems like the best possibility -- after writing the first five records, loop through five more putting initialized values (blanks or zeros) into the the remaining records. I haven't tried this, but since you're trying to use SFLINZ, there might be a different possibility. Write the subfile control format with SFLINZ on and SFLDSP off. That should build a subfile with initialized records. Then load the subfile by looping through your data file file and updating subfile records by relative record number. If there are only five data records, then only the first five subfile records should be updated with data values; the remaining five should still have their initial values. When all data records have been processed, use EXFMT to output the subfile control format again, this time with SFLINZ off and SFLDSP on. Tom
    125,585 pointsBadges:
    report
  • NeilD
    Actually we use this type of entry subfile quite a lot on our system. Whilst not my personal choice of record maintenance, It does allow the users to add/change/delete records very easily. I create the subfile as per normal and load existing records into I/O fields until eof and then add n number of blank records for user entry. If you don't want the user to change an existing record simply set a DSPATR(PR) against fields for the record.
    440 pointsBadges:
    report
  • Splat
    I'd use a for loop to load the blank lines
    For x = ([subfile size] - [records written]) to [subfile size];
     [increment relative record number];
     Write(e) [subfile format];
    EndFor;
    6,835 pointsBadges:
    report
  • TomLiotta
    I create the subfile as per normal and load existing records into I/O fields until eof and then add n number of blank records for user entry. It can be useful for add/change/delete, but it has a pretty limited utility. A file with only, say, 500 records would require this user to scroll down 50 times just to add a single record. It'd seem much better to have an entry subfile selected by appropriate F-key or to have an entry line reserved at the top of the subfile. Switching to an entry subfile should allow more modular code. At least, it seems that way at first thought. If it works for you and user's are happy, that might be the best metric. 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