Announcement

Collapse
No announcement yet.

updating and writing in /free

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

  • updating and writing in /free

    Got a code example? I tried it the old fixed way....

    update frtx03;

    write frtx03;

    But my compiler yelled at me. Something about "Factor 2 operand must not be an externally described file for this operation."

    Waiting for enlightenment
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

  • #2
    Re: updating and writing in /free

    Byrce,

    Update or Write to the record format name, not the file name. Odd I know, but that's the way it's done.

    HTH,
    Mdnghtgmr
    "Tis better to be thought a fool then to open one's mouth and remove all doubt." - Benjamin Franklin

    Comment


    • #3
      Re: updating and writing in /free

      HAHAHAHAHAHA.....i haven't coded rpg in like 4 months....i knew i would forget something

      *puts on dunce cap*
      Your future President
      Bryce

      ---------------------------------------------
      http://www.bravobryce.com

      Comment


      • #4
        Re: updating and writing in /free

        i know its late but here is an update
        and it updates only two fields

        Code:
              *
             fzipcodesb if   e           k disk
             fPCHSPCH   uf   e           k disk    extfile(FileName) usropn
        
             d                SDS
             d  @PGM                 001    010
             d  @PARMS               037    039  0
             d  @MSGDTA               91    170
             d  @MSGID               171    174
             d  @JOB                 244    253
             d  @USER                254    263
             d  @JOB#                264    269  0
        
              //
              // Variable Definition
              //
             d count           s              2  0
             d FileName        s             21
             d found           s              2  0
             d ISodate         s               d
             d library         s             10
             d chr5            s              5
        
              /Free
        
                //--------------------------------------------------------
                // MAIN PROGRAM
                //--------------------------------------------------------
        
        
                   for count = 1 to 12;
        
                    select;
                     when count = 1;
                     library = 'GMCFIL';
                     when count = 2;
                     library = 'GMCQUOTES';
                     when count = 3;
                     library = 'HSAFIL' ;
                     when count = 4;
                     library = 'HSAQUOTES';
                     when count = 6;
                     library = 'LBIFIL';
                     when count = 7;
                     library = 'LBIQUOTES';
                     when count = 9;
                     library = 'LSNFIL';
                     when count = 10;
                     library = 'LSNQUOTES';
                     when count = 11;
                     library = 'PDMFIL';
                     when count = 12;
                     library = 'PDMQUOTES';
                    endsl;
        
        
                    filename = %trim(library) + '/' + 'PCHSPCH';
                    open PCHSPCH;
        
                    setll *start PCHSPCH;
                    read PCHSPCH;
                    dow not%eof(PCHSPCH);
        
        
                     if PHCITY = *blanks or PHSTATE = *BLANKS and
                        PHPKZP <> *zeros;
        
                      chr5 = %editc(phpkzp:'X');
                      chain (chr5) zipcodesb;
                      if %found(zipcodesb);
                       PHCITY  = %trim(CITY);
                       PHSTATE = STATE;
        
                       update PCHSPCHR %fields(PHCITY:PHSTATE);
                      endif;
                     endif;
        
        
                     read PCHSPCH;
                    enddo;
                   close PCHSPCH;
                   endfor;
        
        
                   *inlr = *on;
        
        
              /End-Free
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: updating and writing in /free

          *make mental note*

          Bryce looks pretty @#%@#%@#%@#% funny in a dunce cap! And he tried to write to a FILE NAME?? HAHAHAHAHAHAhahahahahahaha
          -Rick

          _____________________________

          Need a Managed File Transfer Solution -OR- iSeries Encryption?
          GoAnywhere and Crypto Complete by Linoma Software

          Comment

          Working...
          X