Prerun time array in RPGLE

3790 pts.
Tags:
RPGLE array
using prerun time array in RPGLE program...
i have a PF(PF1), declared a field like this-> HDDNO   5P 
without key field....
my coding is
Fpf1      it   f    6        disk                                   
Darray1           s              6p 0 dim(9) fromfile(pf1) perrcd(1)
Di                s              2 0 inz(1)                         
C                   do        9                                      
C     array1(i)     dsply                                            
C                   eval      i=i+1                                  
C                   enddo                                            
C                   eval      *inlr = *on                            
i got an application error, that is  -  Decimal-data error occurred


Software/Hardware used:
as400 v5r3

Answer Wiki

Thanks. We'll let you know when a new response is added.

i got final answer…. i show my pf and rpgle program…

PF:
A R ARR
A HDDNO 5P

RPGLE program:

Farry it f 5 disk
Darray1 s 5p 0 dim(6) fromfile(arry) <b>extfmt(p)</b>
Di s 1p 0 inz(1)
C do 6
C array1(i) dsply
C eval i=i+1
C enddo
C eval *inlr = *on

thanks Mr. Tom

Discuss This Question: 19  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
    You had defined the field with 5 P, When you trying to read the Physical file to Array, Array couldnt identify the record as decimal data. For avaoiding that error, You can mention the field in physical file with 5 P 0. So, that you can avoid the error. Pradeep.
    4,290 pointsBadges:
    report
  • pdsathishkumar
    alright Mr. pradeep, i tried your points. after that i got same error.. i show my PF and coding ones again.. A R ARR -> record format name A HDDNO 5P -> i didn't use decimal position in PF. PF1 contain 9 record's.... Rpgle coding........ Fpf1 it f 5 disk Darray1 s 5p 0 dim(9) fromfile(pf1) perrcd(1) Di s 2p 0 inz(1) C do 9 -> pf have 9 record C array1(i) dsply C eval i=i+1 C enddo C eval *inlr = *on i got same error -- Decimal-data error occurred
    3,790 pointsBadges:
    report
  • pdsathishkumar
    after, i declared pf field like this, A HDDNO 5P 0
    3,790 pointsBadges:
    report
  • philpl1jb
    Would help if you could identify the line where the error occurs Why 5 in this file definition?? Fpf1 it f 5 disk P5 0 is 3 wide. Phil
    51,355 pointsBadges:
    report
  • pdsathishkumar
    i can't identify the error... but i done another program for same concept using alpha numeric field in rpg and pf.. it's working fine (using alpha numeric field).........
    3,790 pointsBadges:
    report
  • philpl1jb
    and did you change this on the packed process Fpf1 it f 5 disk to Fpf1 it f 3 disk
    51,355 pointsBadges:
    report
  • pdsathishkumar
    Fpf1 it f 3 disk i changed like this.. i getting same error - Decimal-data error occurred any other suggestion.... please.......
    3,790 pointsBadges:
    report
  • deepu9321
    Hi Sathish, I have tried same with your code. Initially, I got the same error. But, when i used Physical file field like A HDDNO 5P 0 , it worked fine.
    FTESTPF    IT   F    5        DISK                                 
    DArray1           S              5P 0 DIM(6) FROMFILE(TESTPF)      
    DI                S              2P 0 INZ(1)                       
    C                   Do        6                                    
    C     Array1(I)     Dsply                                          
    C                   Eval      I = I + 1                            
    C                   EndDo                                          
    C                   SETON                                        LR
    and PF is like,
    A          R TESTFMT                  
    A            TESTFLD        5P 0      
    The above code worked fine for me.
    4,290 pointsBadges:
    report
  • pdsathishkumar
    hi pradeep, really i declared like my pf like this A R ARR A HDDNO 5P 0 Farry it f 5 disk Darray1 s 5p 0 dim(9) fromfile(arry) Di s 2p 0 inz(1) C do 6 C array1(i) dsply C eval i=i+1 C enddo C eval *inlr = *on i getting same error - Decimal-data error occurred i checked one more times... but i didn't get answer.......
    3,790 pointsBadges:
    report
  • philpl1jb
    Perhaps one of the entries in the file is bad. How did you enter them, how can you view them? Phil
    51,355 pointsBadges:
    report
  • pdsathishkumar
    Perhaps one of the entries in the file is bad. How did you enter them, how can you view them? Mr. Phil, can't get your point's.......... my pf records like 1000, 2000, 3000... (totally 6 records) i want to display records through my rpg program...
    3,790 pointsBadges:
    report
  • philpl1jb
    When the error occurs can you do a dump. Check the dump spool file for ARRAY1 this listing will show you what was loded into each element of the array.. In the code you've shown you've had a couple of names for the file.. USE the command DSPFFD to check the field structure of the file you are using. my pf records like 1000, 2000, 3000… (totally 6 records) -- it appears that your file does not contain this data in P5 0 format Recompile your file and then enter the data. How do you enter it? How can you see the data in the file? (totally 6 records) - your program DIM(9) is trying to load 9 rows from the file. I would expect a different error/warning Phil
    51,355 pointsBadges:
    report
  • sudheer794
    use Zoned decimal (S) instead of packed (P). it will help you.
    315 pointsBadges:
    report
  • TomLiotta
    First, as Phil said, you should change this line:
    Farry      it   f    3        disk
    You show "5" in your sample. That record is not 5-bytes wide; it is only 3-bytes wide. But I don't that matters a lot. What you really need to change is this line:
    Darray1           s              5p 0 dim(9) fromfile(arry) extfmt(P)
    Because you have a packed-decimal field in your table file, you need to tell the compiler that it is packed. So use the EXTFMT() keyword. Read the reference manual. Search it for "prerun" to see all the things that are mentioned. Tom
    125,585 pointsBadges:
    report
  • pdsathishkumar
    use Zoned decimal (S) instead of packed (P). it will help you. i changed to zoned decimal (S), it's also got same error.. finally i got answer using Extfmt(P) keyword........ from Tom...... thanks to all....
    3,790 pointsBadges:
    report
  • TomLiotta
    A "prerun"-time table file is generally not intended to be anything but character data. It cannot be declared as externally described. So you need to give the EXTFMT(P) hint to the compiler so it will use packed-decimal instructions to copy data from the input records into the array. The definition of the array is not the same as the definition of the record in the file. Tom
    125,585 pointsBadges:
    report
  • pdsathishkumar
    thanks Mr. Tom, your explanation very useful for my AS400 carrier.... Thanks to all, sathish
    3,790 pointsBadges:
    report
  • sudheer794
    I used zoned in file as well in program.. it worked for me... :)
    315 pointsBadges:
    report
  • pdsathishkumar
    I used zoned in file as well in program.. it worked for me… Mr. Sudheer i tried zoned decimal (S), it's not working for me.... after i had using extfmt(P) keyword, my program worked fine... so, not possible zoned data type for this concept... if you want to try ones again, i shared above my program.....
    3,790 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