ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

comparision of fields...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • comparision of fields...

    Hai,
    I have written a program in which i could enter a part range and the quantity sold for the part will be printed.The logic i used was

    Code:
    item       IFLT     (FROM ITEM)
                  ITER
                 ENDIF
    ITEM       IFGT    (TO ITEM)
                   STOPREADING 
                   ENDIF
    This is working fine, when the part range entered are parts existing its giving the correct report.
    Now i want to enter just an alphabet range instead of entering the full part name.Suppose if i enter the range as A to B, all parts of 'A' is printing but when it comes to second condition its failing.Why is Parts starting with 'B' is not printing.pls help.

    Thanx,
    Andrew...

  • #2
    Re: comparision of fields...

    If Item is NOT allways in UPPERCASE then code in your dds (place it in your LF at the 1ste line)
    Code:
    A                                      ALTSEQ(QSYSTRNTBL)
    If the Item is not sorted by key then I would code something like

    first idea:
    read all records in a loop and test , this is not good coding !
    Code:
    C  ITEM      IFGE  fromITEM      
    C  ITEM      ANDLE toITEM        
    C* found 
    C	     ELSE
    C*not found
    C	     END
    Better: You should make a LF with a key ITEM
    Then
    Code:
    C fromITEM Setll yrfile  
    C          READ yrfile                   50 
    C *IN50    IFEQ '0' 
    C  item    ANDLE toITEM    
    C* ok to print itemlist here
    C          READ yrfile                   50 
    C          ENDDO
    From an RPGIV only programmer: If I have made no mistake, it should work !

    Comment

    Working...
    X