subfile - IBM AS400

This is a discussion on subfile - IBM AS400 ; what happen if u read empty database file into subfile? if any one knows please tell me...

+ Reply to Thread
Results 1 to 3 of 3

Thread: subfile

  1. subfile

    what happen if u read empty database file into subfile?

    if any one knows please tell me


  2. Re: subfile

    On Jun 6, 10:13 am, chakri.madh...@gmail.com wrote:
    > what happen if u read empty database file into subfile?
    >
    > if any one knows please tell me


    I'll try to answer by giving a quick code snippet:

    /free

    *in30 = *off // no sfl dsp
    clear rrn;

    dou %eof(myfile);
    read myfile;
    if not %eof(myfile);
    rrn += 1;
    write sfl;
    endif;
    enddo;

    if rrn > *zeros;
    *in30 = *on; // dsp sfl
    endif:
    /end-free

    ind 30 is for SFLDSP -- if there are records (i.e. rrn > *zeros), 30
    is turned on and the subfile is displayed. If not, 30 remains off and
    the subfile is not displayed. If you try to display a sfl with no
    records written to it, the pgm blows up.

    Note: I only threw in enough code snippet to illustrate the point.
    Note that it does not include stuff like SFLCLR, etc.


  3. Re: subfile

    I am sure that you are incrementing a counter (rel rec no) as you write
    to your subfile. After processing the records added to the subfile you
    should test the value of that counter. If it is one (1) return the
    record found, if it is zero issue an error stating that no records were
    found, if it is greater than one display the subfile.
    D.J.

    chakri.madhira@gmail.com wrote:
    > what happen if u read empty database file into subfile?
    >
    > if any one knows please tell me
    >



+ Reply to Thread