SFL

380 pts.
Tags:
RPG
RPGLE
SFL
I have a SFL. In which I have a option selection field. I have used reverse image indicator for it. But when I insert a wrong value in that field, then the entire column is highlighted instead of the option selection field for that particular record. What should I do?

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: 17  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
  • TomLiotta
    what should i do..?   Well, if you want help, the first thing you should do is show us the DDS that defines the subfile record, especially the definition of the reverse-image. You should also show the program code that sets reverse-image *ON and also sets it *OFF, and that writes subfile records.   We have no way to know what might need to be changed if we don't see what you have.   Tom
    125,585 pointsBadges:
    report
  • jainamit
    C                   Eval      *In25 = *Off     C                   Eval      *In32 = *Off     C                   ReadC     Sflrec           C                   DoW       Not %EoF(Amitsfl) *                                             C                   If        FLD002= 4        C                   Eval      *In25 = *On      C     FlD005        Chain     AMITPF           C                   If        %Found(AMITPF)   C                   Delete    AMITRCD          C                   EndIf                      C                   Endif                      C                   If        Fld002 <> 0      C                   Eval      *In32 = *On      C                   Endif                      C                   ReadC     Sflrec           C                   EndDo                     
    380 pointsBadges:
    report
  • jainamit
    this is what i have tried.
    380 pointsBadges:
    report
  • jainamit
    25 ins for sflnxtchg and 32 is for reverse image
    380 pointsBadges:
    report
  • TomLiotta
    First, I don't see anything in there that writes a subfile record; so that's not a very useful part of the program. It reads subfile records and sets a few indicators, but it never puts the indicators nor the updated records back in the subfile. (That might be one part of the error with your code.)   Second, you didn't show any DDS for the subfile record. If we can't see the DDS, we can't tell what the programming means.   Finally, it's not part of the error; but you can make things look a little better when you post code here if you do it a little differently. A 5250 emulator screen doesn't have any carriage-return or line-feed characters. When you copy and paste from your terminal screen, paste into Notepad first. Make sure you add end-of-line in Notepad, then copy and paste it here. Or you can add end-of-lines here if you don't use Notepad.   Tom
    125,585 pointsBadges:
    report
  • jainamit
    FAMITPF UF A E K Disk FAMITSFL CF E Workstn Sfile(Sflrec:Rrn) * DwVar1 S 10A Inz('Amit') DValiflg S 1A Inz('Y') DwVar2 S 7P 0 * C DoW *In03 = *Off C Exsr Srload C Write sflftr C* Write sflfctl C Exfmt sflctl C Exsr Srprocess C enddo C Eval *Inlr = *On C * C Srload Begsr C Eval *In30 = *Off C Eval *In31 = *Off C Eval Rrn = *Zeros C Write Sflctl C *loval Setll AMITPF C Read AMITRCD C DoW Not %Eof(AMITPF) And C Rrn 0 C Eval *In30 = *On C EndIf * C If Rrn < 9999 C Eval *In31 = *Off C EndIf * C EndSr * C Srprocess Begsr * C Eval *In25 = *Off C Eval *In32 = *Off C ReadC Sflrec C DoW Not %EoF(Amitsfl) * C If FLD002= 4 C Eval *In25 = *On C FlD005 Chain AMITPF C If %Found(AMITPF) C Delete AMITRCD C EndIf C Endif C If Fld002 0 C Eval *In32 = *On C Endif C ReadC Sflrec C EndDo * C EndSr
    380 pointsBadges:
    report
  • jainamit
    this is the entire prog... the problem is that when i give any wrong input in the option field then the entire column is filled with that input and the reverse image is turned on for the entire column
    380 pointsBadges:
    report
  • TomLiotta
    this is the entire prog…   Okay, but there are no WRITE statements that I can see for the subfile and there are no statements that update the subfile. The program doesn't make sense if it never writes any subfile records. I do see a single WRITE for what is probably the subfile control record, but none for the subfile. And I also see that you don't set *IN25 and *IN32  back to *OFF after you set them on in your READC loop.   And you still aren't showing any DDS for the subfile. The program isn't very useful for us without the subfile definition.   BTW, that was a much nicer way to put program source into a comment. It was much easier to read.   Tom
    125,585 pointsBadges:
    report
  • jainamit
      all i want is to delete the record from the file. It is working fine. only prob is wen i gave a wrong input. the reverse image in not working properly.     A*%%TS  SD  20130327  112109  IT665       REL-V5R4M0  5722-WDS    A*%%EC                                                            A                                      DSPSIZ(24 80 *DS3)         A          R SFLREC                    SFL                        A*%%TS  SD  20130327  072929  IT665       REL-V5R4M0  5722-WDS    A  25                                  SFLNXTCHG                  A            FLD005         6S 0O  4 13                           A            FLD006         6S 0O  4 52                           A            FLD002         1S 0B  4  3                           A  32                                  DSPATR(RI)                 A  32                                  DSPATR(PC)                 A          R SFLCTL                    SFLCTL(SFLREC)             A*%%TS  SD  20130327  084811  IT665       REL-V5R4M0  5722-WDS    A                                      CF03(03 'EXIT FROM THE PROGA                                      OVERLAY                    A  30                                  SFLDSP      A                                      SFLDSPCTL              A N30                                  SFLCLR                 A N31                                  SFLEND(*MORE)          A                                      SFLSIZ(9999)           A                                      SFLPAG(0008)           A                                  1 33'USER'                 A            RRN            3S 0H                             A                                  3 11'EMPLOYEE ID'          A                                  3 49'CARD NUMBER'          A                                  3  2'OPTION'               A          R SFLFTR                                           A*%%TS  SD  20130327  112109  IT665       REL-V5R4M0  5722-WDSA                                 22  3'F3=EXIT'              A                                      COLOR(BLU)             A                                 22 24'4 = Delete'           A                                      COLOR(BLU)                          
    380 pointsBadges:
    report
  • jainamit
    A*%%TS SD 20130327 112109 IT665 REL-V5R4M0 5722-WDS A*%%EC A DSPSIZ(24 80 *DS3) A R SFLREC SFL A*%%TS SD 20130327 072929 IT665 REL-V5R4M0 5722-WDS A 25 SFLNXTCHG A FLD005 6S 0O 4 13 A FLD006 6S 0O 4 52 A FLD002 1S 0B 4 3 A 32 DSPATR(RI) A 32 DSPATR(PC) A R SFLCTL SFLCTL(SFLREC) A*%%TS SD 20130327 084811 IT665 REL-V5R4M0 5722-WDS A CF03(03 'EXIT FROM THE PROG A OVERLAY A 30 SFLDSP A SFLDSPCTL A N30 SFLCLR A N31 SFLEND(*MORE) A SFLSIZ(9999) A SFLPAG(0008) A 1 33'USER' A RRN 3S 0H A 3 11'EMPLOYEE ID' A 3 49'CARD NUMBER' A 3 2'OPTION' A R SFLFTR A*%%TS SD 20130327 112109 IT665 REL-V5R4M0 5722-WDS A 22 3'F3=EXIT' A COLOR(BLU) A 22 24'4 = Delete' A COLOR(BLU)
    380 pointsBadges:
    report
  • philpl1jb
    .. not sure where we're at .. but here are my observations:
    A 	FLD002 1S 0B 4 3
    A 32 			DSPATR(RI)
    
    If you write or update SFLREC with *IN32 on 
    The field will be displayed in reverse image.
    You're code should only turn on *IN32 just 
    before writing or updating the record in error 
    and should turn it off just  after writing 
    or updating the record.
    
    A 32 			DSPATR(PC)
    
    The position cursor keyword will not work with
    Subfiles.  Positioning the cursor on a subfile 
    Record is done with the SFLRCDNBR(CURSOR) 
    kewword which is added to the control file.
    
    51,365 pointsBadges:
    report
  • TomLiotta
    It took some time to understand how the program was written. It looked like one or more lines were missing at first, but then I started seeing what was happening. I have made a couple minor logic changes, and I also changed it to "free-form". My copy now looks like this:
         H option(*nodebugio)
         FAMITPF    UF A E           k Disk
         FAMITSFL   CF   e             Workstn Sfile(Sflrec:Rrn)
          *
         DwVar1            S             10A   Inz('Amit')
         DValiflg          S              1A   Inz('Y')
         DwVar2            S              7P 0
    
         D SFLNXTCHG       c                   25
         D DspRI           c                   32
         D SFLDSP          c                   30
         D SFLEND          c                   31
          /free
              DoW       *In03 = *Off ;
                 Exsr      Srload ;
                 write     sflftr ;
              // Write sflfctl
                 dou  *in( DspRI ) = *off ;
                    Exfmt     sflctl ;
                    Exsr      Srprocess ;
                 enddo ;
              enddo ;
              *Inlr = *On ;
    
    
           Begsr Srload ;
              *In( SFLDSP ) = *Off ;
              *In( SFLEND ) = *Off ;
              Rrn = *Zeros ;
              Write     Sflctl ;
              Setll *loval AMITPF ;
              Read      AMITRCD ;
              DoW  Not %Eof(AMITPF) ;
                 FLD005 = K1 ;
                 FLD006 = F1 ;
                 FLD002 = 0 ;
                 Rrn += 1 ;
                 write     sflrec ;
                 Read      AMITRCD ;
              enddo ;
    
              *In( SFLDSP ) = *On ;
    
              If Rrn < 9999 ;
                 *In( SFLEND ) = *Off ;
              EndIf ;
    
              EndSr ;
    
           Begsr Srprocess ;
    
              *In( SFLNXTCHG ) = *Off ;
              ReadC     Sflrec ;
              DoW  Not %EoF( AMITSFL ) ;
    
                 *In( DspRI ) = *Off ;
    
                 If  FLD002= 4 ;
                    Chain FlD005 AMITPF ;
                    If  %Found( AMITPF ) ;
                       Delete    AMITRCD ;
                    EndIf ;
                 Endif ;
    
                 If Fld002 <> 0 and Fld002 <> 4 ;
                    *In( DspRI ) = *On ;
                    Update    Sflrec ;
                 Endif ;
    
                 ReadC     Sflrec ;
    
              EndDo ;
    
              EndSr ;
          /end-free
    You should copy this version into Notepad and copy your version into a second Notepad window. Line them up side by side and compare the changes.   When you have a question, post back here.   I created a trivial version of a PF named AMITPF, with three fields -- K1, F1 and F2. I needed field names to move into the subfile fields. The K1 field is the key field, and F2 isn't referenced by the program. Where I use K1 and F1, you would use the field names from AMITPF. If you named them FLD005 and FLD006 so they matched your subfile fields, then you can ignore my fields.   (And note how both reverse-image and position-cursor work even without SFLRCDNBR.)   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Tom, the DSPATR(PC) will position the cursor if there are multiple pages loaded and the error in on the second page?
    51,365 pointsBadges:
    report
  • TomLiotta
    ...DSPATR(PC) will position the cursor if there are multiple pages loaded and the error in on the second page?   Yes. (And no.)   It will position the cursor just fine as long as a page with PC is currently on the display. If you scroll through the subfile, each page with a line that has PC active will cause the cursor to position to that line. But it won't position the subfile to those pages.   The SFLRCDNBR() function can determine which page to display.   The two functions can therefore be used together for very good effect, but PC works either way.   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Thanks, Tom, thought this was another senior moment.SFLRCDNBR() will position on the subfile page where the RRN is located.  It's used whenever the program needs to control which page of a multi-page subfile is to be displayed and would work as you said for this case.SFLRCDNBR(CURSOR) will position the cursor on the desired row and since in this case the record has only one input capable field, on the desired field.  Phil
    51,365 pointsBadges:
    report
  • TomLiotta
    This particular subfile is clearly a self-learning exercise, so the basic behavior of PC (or actually RI) was the main point. The logic doesn't quite match up with real-world. The subfile was being completely rebuilt every time; so once RI was set on, it was on all the way through the rebuild. I added a small inner loop that only continued as long as RI was still on. And I added an update to the subfile that marked only incorrect subfile records for RI (and PC). The subfile processing loop sets RI off at its beginning, so it'll still be off if all records are correct.   One thing I didn't do was DELETE subfile records that correctly caused the PF records to be deleted. We can let that be an exercise for learners who want to see what happens when SFLRCDNBR is added to this program. What is the correct record number after subfile records have been deleted and the same subfile is redisplayed?   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Typically on the (first or last) page where a delete(s) occurred.  It seems to be a bit confusing to return to the first page of the subfile and wonder .. did the delete(s) work???; Or return to whatever page was being displayed at the time .. which requires yet another keyword to capture the RRN of the cursor position ..  SFLCSRRRN.  And what to do when the last record is deleted.
    51,365 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