How to write a saved file to IFS - IBM AS400

This is a discussion on How to write a saved file to IFS - IBM AS400 ; Hi there, I need to save a library into a SAVF file and put it into a directory in the IFS, but I cannot find the proper command to copy that saved file to the IFS. Can anyone of you ...

+ Reply to Thread
Results 1 to 20 of 20

Thread: How to write a saved file to IFS

  1. How to write a saved file to IFS

    Hi there,

    I need to save a library into a SAVF file and put it into a directory in the
    IFS, but I cannot find the proper command to copy that saved file to the
    IFS. Can anyone of you help me out ?

    TIA
    Pjotr



  2. Re: How to write a saved file to IFS

    On Mar 23, 9:44 am, "Pjotr" wrote:
    > Hi there,
    >
    > I need to save a library into a SAVF file and put it into a directory in the
    > IFS, but I cannot find the proper command to copy that saved file to the
    > IFS. Can anyone of you help me out ?
    >
    > TIA
    > Pjotr


    I would use FTP. From the as400 simply ftp to localhost. If you system
    defaults to namefmt 0 then cd your way to the ifs location with a
    leading / to avoid the namefmt command. Next
    bin
    put yourlib/yoursavf

    If your system defaults to namefmt 1 when you logon you will need to
    adjust the put to read
    put /QSYS.LIB/yourlib.lib/yoursavf.savf
    If you get the namefmts and or 'directories' mixed up between the
    source & target machine then I wouldnt be surprised - I did just now
    when checking. Type pwd, lpwd or namefmt to see the current state of
    play.

    You can do an ovrdbf on the savf & open it in an RPG program but that
    takes time. Also CPYTOSTMF is supposed to work but I didnt try it.

    HTH
    Jonathan


  3. Re: How to write a saved file to IFS

    "Jonathan Bailey" writes:

    > On Mar 23, 9:44 am, "Pjotr" wrote:
    >> Hi there,
    >>
    >> I need to save a library into a SAVF file and put it into a directory in the
    >> IFS, but I cannot find the proper command to copy that saved file to the
    >> IFS. Can anyone of you help me out ?

    >
    > I would use FTP. From the as400 simply ftp to localhost. If you system
    > defaults to namefmt 0 then cd your way to the ifs location with a
    > leading / to avoid the namefmt command. Next
    > bin
    > put yourlib/yoursavf
    >
    > If your system defaults to namefmt 1 when you logon you will need to
    > adjust the put to read
    > put /QSYS.LIB/yourlib.lib/yoursavf.savf
    > If you get the namefmts and or 'directories' mixed up between the
    > source & target machine then I wouldnt be surprised - I did just now
    > when checking. Type pwd, lpwd or namefmt to see the current state of
    > play.


    Oddly enough, i was just trying to ftp a savf tonight from one LPAR to
    another and found that ftp wanted to transfer the file in binary image
    format and that the resulting file on the other LPAR was no longer
    listed as a savf and would not restore.

    I later figured out how to use SAVRSTOBJ to send it to the other
    partition, but i am wondering what was going on, and how one would (if
    one can) go about ftp-ing a savf in this kind of circumstance. Any
    wisdom?

    --
    þ theron tlåx þ
    (compose-mail (concat "thorne@" (rot13 "gvzoeny") ".net"))

  4. Re: How to write a saved file to IFS

    On Mar 23, 8:34 am, thorne wrote:
    > "Jonathan Bailey" writes:
    > > On Mar 23, 9:44 am, "Pjotr" wrote:
    > >> Hi there,

    >
    > >> I need to save a library into a SAVF file and put it into a directory in the
    > >> IFS, but I cannot find the proper command to copy that saved file to the
    > >> IFS. Can anyone of you help me out ?

    >
    > > I would use FTP. From the as400 simply ftp to localhost. If you system
    > > defaults to namefmt 0 then cd your way to the ifs location with a
    > > leading / to avoid the namefmt command. Next
    > > bin
    > > put yourlib/yoursavf

    >
    > > If your system defaults to namefmt 1 when you logon you will need to
    > > adjust the put to read
    > > put /QSYS.LIB/yourlib.lib/yoursavf.savf
    > > If you get the namefmts and or 'directories' mixed up between the
    > > source & target machine then I wouldnt be surprised - I did just now
    > > when checking. Type pwd, lpwd or namefmt to see the current state of
    > > play.

    >
    > Oddly enough, i was just trying to ftp a savf tonight from one LPAR to
    > another and found that ftp wanted to transfer the file in binary image
    > format and that the resulting file on the other LPAR was no longer
    > listed as a savf and would not restore.
    >
    > I later figured out how to use SAVRSTOBJ to send it to the other
    > partition, but i am wondering what was going on, and how one would (if
    > one can) go about ftp-ing a savf in this kind of circumstance. Any
    > wisdom?
    >
    > --
    > theron tlx
    > (compose-mail (concat "thorne@" (rot13 "gvzoeny") ".net"))- Hide quoted text -
    >
    > - Show quoted text -


    Try creating a SAVF on the target system. Then run the FTP to the
    SAVF.


  5. Re: How to write a saved file to IFS

    > You can do an ovrdbf on the savf & open it in an RPG program but that
    > takes time. Also CPYTOSTMF is supposed to work but I didnt try it.
    >
    > HTH
    > Jonathan


    We've used CPYTOSTMF:

    ex:

    /* Copy RAFLAT to IFS as .txt File. */
    TOIFS: CPYTOSTMF +
    FROMMBR('/QSYS.LIB/FMSV3DB01.LIB/RAFLAT.FIL+
    E/RAFLAT.MBR') TOSTMF(&FILE2) +
    STMFOPT(*REPLACE) ENDLINFMT(*LF)

    peace
    that 1 guy


  6. Re: How to write a saved file to IFS

    But can this be done with a saved file, i.e. *.SAVF/*.MBR ?

    Pjotr

    that 1 guy wrote:
    >> You can do an ovrdbf on the savf & open it in an RPG program but that
    >> takes time. Also CPYTOSTMF is supposed to work but I didnt try it.
    >>
    >> HTH
    >> Jonathan

    >
    > We've used CPYTOSTMF:
    >
    > ex:
    >
    > /* Copy RAFLAT to IFS as .txt File. */
    > TOIFS: CPYTOSTMF +
    > FROMMBR('/QSYS.LIB/FMSV3DB01.LIB/RAFLAT.FIL+
    > E/RAFLAT.MBR') TOSTMF(&FILE2) +
    > STMFOPT(*REPLACE) ENDLINFMT(*LF)
    >
    > peace
    > that 1 guy




  7. Re: How to write a saved file to IFS

    il 23/03/2007 10.44, Scrive Pjotr 40592720:
    > Hi there,
    >
    > I need to save a library into a SAVF file and put it into a directory in the
    > IFS, but I cannot find the proper command to copy that saved file to the
    > IFS. Can anyone of you help me out ?

    The proper command is CPYTOSTMF, e.g.:
    CPYTOSTMF FROMMBR('/qsys.lib/your_lib.lib/save_file.file')
    TOSTMF('/home/myhome/savefile.savf')
    STMFOPT(*REPLACE)
    CVTDTA(*NONE)

    --
    Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAe joAlcoolInside
    Spaccamaroni andate a cagare/Spammers not welcome/Spammers vo merda
    Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
    schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'

  8. Re: How to write a saved file to IFS

    When using FTP to transfer objects from one system to an other,
    one always should state the name of the object twice so the target
    system will create the object correctly. I found, sometimes the
    file name is transferred in upper case if omitted and the target
    system will be confused.

    Thus, use this method:

    FTP (target system)
    (signon)
    cd /some/where (on the target system)
    namefmt 1 (if using AS400-FTP, or QUOTE SITE NAMEFMT 1)
    lcd /my/source (on the target system)
    bin (binary transfer)
    put mylib.savf mylib.savf (twice stated, save file does not need to
    exist on target system)
    exit

    -h


    "Graybeard" schrieb im Newsbeitrag
    news:1174654677.610134.299040@e65g2000hsc.googlegr oups.com...

    Try creating a SAVF on the target system. Then run the FTP to the
    SAVF.



  9. Re: How to write a saved file to IFS

    On Mar 23, 9:44 pm, "Pjotr" wrote:
    > Hi there,
    >
    > I need to save a library into a SAVF file and put it into a directory in the
    > IFS, but I cannot find the proper command to copy that saved file to the
    > IFS. Can anyone of you help me out ?
    >
    > TIA
    > Pjotr



    Your SAVF is already in the IFS. The IFS is the operating systems
    file system of which the library file system is just a part...
    My question is why do you need to do this? What is the point in
    copying it to the /root file system?


  10. Re: How to write a saved file to IFS

    jsev99@yahoo.co.nz wrote:
    > On Mar 23, 9:44 pm, "Pjotr" wrote:
    >> Hi there,
    >>
    >> I need to save a library into a SAVF file and put it into a
    >> directory in the IFS, but I cannot find the proper command to copy
    >> that saved file to the IFS. Can anyone of you help me out ?
    >>
    >> TIA
    >> Pjotr

    >
    >
    > Your SAVF is already in the IFS. The IFS is the operating systems
    > file system of which the library file system is just a part...
    > My question is why do you need to do this? What is the point in
    > copying it to the /root file system?


    I think you are right. I have to get the savf file from the AS400
    onto a pc and store it there.

    Thx
    Pjotr



  11. Re: How to write a saved file to IFS

    On Mar 26, 9:13 pm, "Pjotr" wrote:
    > jse...@yahoo.co.nz wrote:
    > > On Mar 23, 9:44 pm, "Pjotr" wrote:
    > >> Hi there,

    >
    > >> I need to save a library into a SAVF file and put it into a
    > >> directory in the IFS, but I cannot find the proper command to copy
    > >> that saved file to the IFS. Can anyone of you help me out ?

    >
    > >> TIA
    > >> Pjotr

    >
    > > Your SAVF is already in the IFS. The IFS is the operating systems
    > > file system of which the library file system is just a part...
    > > My question is why do you need to do this? What is the point in
    > > copying it to the /root file system?

    >
    > I think you are right. I have to get the savf file from the AS400
    > onto a pc and store it there.
    >
    > Thx
    > Pjotr



    In that case, you can FTP it directly from the library in binary mode.
    The library file system is NAMEFMT 0 so if this is not your system
    default, issue the command NAMEFMT 0 if transferring from the AS400 to
    the PC, or QUOTE SITE NAMEFMT 0 if transferring from the PC to the
    AS400. After that, issue the usual FTP commands.


  12. Re: How to write a saved file to IFS

    On Mar 23, 5:34 am, thorne wrote:
    > "Jonathan Bailey" writes:
    > > On Mar 23, 9:44 am, "Pjotr" wrote:
    > >> Hi there,

    >
    > >> I need to save a library into a SAVF file and put it into a directory in the
    > >> IFS, but I cannot find the proper command to copy that saved file to the
    > >> IFS. Can anyone of you help me out ?

    >
    > > I would use FTP. From the as400 simply ftp to localhost. If you system
    > > defaults to namefmt 0 then cd your way to the ifs location with a
    > > leading / to avoid the namefmt command. Next
    > > bin
    > > put yourlib/yoursavf

    >
    > > If your system defaults to namefmt 1 when you logon you will need to
    > > adjust the put to read
    > > put /QSYS.LIB/yourlib.lib/yoursavf.savf
    > > If you get the namefmts and or 'directories' mixed up between the
    > > source & target machine then I wouldnt be surprised - I did just now
    > > when checking. Type pwd, lpwd or namefmt to see the current state of
    > > play.

    >
    > Oddly enough, i was just trying to ftp a savf tonight from one LPAR to
    > another and found that ftp wanted to transfer the file in binary image
    > format and that the resulting file on the other LPAR was no longer
    > listed as a savf and would not restore.
    >
    > I later figured out how to use SAVRSTOBJ to send it to the other
    > partition, but i am wondering what was going on, and how one would (if
    > one can) go about ftp-ing a savf in this kind of circumstance. Any
    > wisdom?


    I hadn't seen the SAVRSTOBJ command before; thanks for mentioning
    that.

    As far as FTP to send the save file, the save file must already exist
    on the target system. If not, then FTP will create a database file on
    the target system with the same name as the save file on the source
    system.

    If you have sufficient authority, you can create the save file on the
    target system from within your FTP session (which I presume you start
    on the source system):

    FTP [target system]
    [sign on]
    quote rcmd crtsavf mytgtlib/mytgtsavf
    bin
    put mysrclib/mysrcsavf mytgtlib/mytgtsavf


  13. Re: How to write a saved file to IFS

    On Mar 24, 12:34 am, thorne wrote:
    > "Jonathan Bailey" writes:
    > > On Mar 23, 9:44 am, "Pjotr" wrote:
    > >> Hi there,

    >
    > >> I need to save a library into a SAVF file and put it into a directory in the
    > >> IFS, but I cannot find the proper command to copy that saved file to the
    > >> IFS. Can anyone of you help me out ?

    >
    > > I would use FTP. From the as400 simply ftp to localhost. If you system
    > > defaults to namefmt 0 then cd your way to the ifs location with a
    > > leading / to avoid the namefmt command. Next
    > > bin
    > > put yourlib/yoursavf

    >
    > > If your system defaults to namefmt 1 when you logon you will need to
    > > adjust the put to read
    > > put /QSYS.LIB/yourlib.lib/yoursavf.savf
    > > If you get the namefmts and or 'directories' mixed up between the
    > > source & target machine then I wouldnt be surprised - I did just now
    > > when checking. Type pwd, lpwd or namefmt to see the current state of
    > > play.

    >
    > Oddly enough, i was just trying to ftp a savf tonight from one LPAR to
    > another and found that ftp wanted to transfer the file in binary image
    > format and that the resulting file on the other LPAR was no longer
    > listed as a savf and would not restore.
    >
    > I later figured out how to use SAVRSTOBJ to send it to the other
    > partition, but i am wondering what was going on, and how one would (if
    > one can) go about ftp-ing a savf in this kind of circumstance. Any
    > wisdom?
    >
    > --
    > theron tlx
    > (compose-mail (concat "thorne@" (rot13 "gvzoeny") ".net"))- Hide quoted text -
    >
    > - Show quoted text -


    If you FTP from one LPAR to another, is the system smart enough to
    bypass the LAN?

    Is the same true when using SAVRSTOBJ between LPARs?

    Cheers,
    JohnO


  14. Re: How to write a saved file to IFS

    Jonathan Ball wrote:
    > On Mar 23, 5:34 am, thorne wrote:
    >> "Jonathan Bailey" writes:
    >>> On Mar 23, 9:44 am, "Pjotr" wrote:
    >>>> Hi there,
    >>>> I need to save a library into a SAVF file and put it into a directory in the
    >>>> IFS, but I cannot find the proper command to copy that saved file to the
    >>>> IFS. Can anyone of you help me out ?
    >>> I would use FTP. From the as400 simply ftp to localhost. If you system
    >>> defaults to namefmt 0 then cd your way to the ifs location with a
    >>> leading / to avoid the namefmt command. Next
    >>> bin
    >>> put yourlib/yoursavf
    >>> If your system defaults to namefmt 1 when you logon you will need to
    >>> adjust the put to read
    >>> put /QSYS.LIB/yourlib.lib/yoursavf.savf
    >>> If you get the namefmts and or 'directories' mixed up between the
    >>> source & target machine then I wouldnt be surprised - I did just now
    >>> when checking. Type pwd, lpwd or namefmt to see the current state of
    >>> play.

    >> Oddly enough, i was just trying to ftp a savf tonight from one LPAR to
    >> another and found that ftp wanted to transfer the file in binary image
    >> format and that the resulting file on the other LPAR was no longer
    >> listed as a savf and would not restore.
    >>
    >> I later figured out how to use SAVRSTOBJ to send it to the other
    >> partition, but i am wondering what was going on, and how one would (if
    >> one can) go about ftp-ing a savf in this kind of circumstance. Any
    >> wisdom?

    >
    > I hadn't seen the SAVRSTOBJ command before; thanks for mentioning
    > that.
    >
    > As far as FTP to send the save file, the save file must already exist
    > on the target system. If not, then FTP will create a database file on
    > the target system with the same name as the save file on the source
    > system.
    >
    > If you have sufficient authority, you can create the save file on the
    > target system from within your FTP session (which I presume you start
    > on the source system):
    >
    > FTP [target system]
    > [sign on]
    > quote rcmd crtsavf mytgtlib/mytgtsavf
    > bin
    > put mysrclib/mysrcsavf mytgtlib/mytgtsavf
    >


    As someone pointed out long ago in this newsgroup, using namefmt 1 and a
    suffix of ".savf" will also cause creation of a save file on the target
    system (not a database file), if the save file doesn't exist:

    > bin
    > namefmt 1
    > put /qsys.lib/kch.lib/usenettst.savf /qsys.lib/kch.lib/usenettst.savf


    --
    Karl Hanson

  15. Re: How to write a saved file to IFS

    Holger Scherer wrote:
    > When using FTP to transfer objects from one system to an other,
    > one always should state the name of the object twice so the target
    > system will create the object correctly. I found, sometimes the
    > file name is transferred in upper case if omitted and the target
    > system will be confused.
    >
    > Thus, use this method:
    >
    > FTP (target system)
    > (signon)
    > cd /some/where (on the target system)
    > namefmt 1 (if using AS400-FTP, or QUOTE SITE NAMEFMT 1)
    > lcd /my/source (on the target system)
    > bin (binary transfer)
    > put mylib.savf mylib.savf (twice stated, save file does not need to
    > exist on target system)
    > exit


    I see Karl Hanson has already mentioned this, but I'll send anyway with
    a little more description.

    FTP under OS/400 or i5/OS recognizes the .SAVF extension when using
    NAMEFMT 1 and will create a savefile. The reason to have it "twice
    stated" would be to have a different name on the receiving system. A
    savefile must be transferred as BINARY because it's not text data and
    should not be translated due to different character encodings -- a
    savefile is a binary file.

    namefmt 1
    bin
    put mylib.savf

    Those FTP subcommands are sufficient to transfer savefile MYLIB to the
    remote system. It will be created as a savefile in the current directory.

    To work, it must be transferred BINARY, it must be done under NAMEFMT 1
    _and_ the extension must be .SAVF. The .SAVF extension works by default
    when transferring to or from an AS/400. If the sending or receiving
    system is a PC for example, then the file must actually have .SAVF as
    the extension.

    --
    Tom Liotta
    http://zap.to/tl400

  16. Re: How to write a saved file to IFS

    JohnO wrote:

    > If you FTP from one LPAR to another, is the system smart enough to
    > bypass the LAN?


    John:

    Yes, if you connect to the IP address that bypasses the LAN.

    Normally, there will be a regular route through the LAN that would be
    reached by the IP address that is known to the LAN. But LPARs generally
    have an internal "virtual" route also. This route should be on a
    different subnet and only be available to the various LPARs. The IP
    address may be linked to a second host name in the hosts table.

    If you FTP to the virtual host name or virtual IP address, it works fine
    as long as it's configured correctly. Often, throughput is one or more
    orders of magnitude better.

    > Is the same true when using SAVRSTOBJ between LPARs?


    Yes. Again, if it's configured to do so.

    The different LPARs don't know each other as anything but different
    systems. There's no reason they'd try to reach each other through the
    virtual LAN except if you used the virtual addressing.

    --
    Tom Liotta
    http://zap.to/tl400

  17. Re: How to write a saved file to IFS

    Reading your last paragraph, does the reference to a virtual LAN mean that
    LPARs operate in much the same way as guest 36 machines used to?

    Peter Kinsman

    "Tom Liotta" wrote in message
    news:OcCdnRuAdYeHhJPbnZ2dnUVZ_uCinZ2d@centurytel.n et...
    > JohnO wrote:
    >
    >> If you FTP from one LPAR to another, is the system smart enough to
    >> bypass the LAN?

    >
    > John:
    >
    > Yes, if you connect to the IP address that bypasses the LAN.
    >
    > Normally, there will be a regular route through the LAN that would be
    > reached by the IP address that is known to the LAN. But LPARs generally
    > have an internal "virtual" route also. This route should be on a different
    > subnet and only be available to the various LPARs. The IP address may be
    > linked to a second host name in the hosts table.
    >
    > If you FTP to the virtual host name or virtual IP address, it works fine
    > as long as it's configured correctly. Often, throughput is one or more
    > orders of magnitude better.
    >
    >> Is the same true when using SAVRSTOBJ between LPARs?

    >
    > Yes. Again, if it's configured to do so.
    >
    > The different LPARs don't know each other as anything but different
    > systems. There's no reason they'd try to reach each other through the
    > virtual LAN except if you used the virtual addressing.
    >
    > --
    > Tom Liotta
    > http://zap.to/tl400




  18. Re: How to write a saved file to IFS

    jsev99 wrote:

    > In that case, you can FTP it directly from the library in binary mode.
    > The library file system is NAMEFMT 0 so if this is not your system
    > default, issue the command NAMEFMT 0 if transferring from the AS400 to
    > the PC, or QUOTE SITE NAMEFMT 0 if transferring from the PC to the
    > AS400. After that, issue the usual FTP commands.


    Just a minor note -- You can FTP to or from the QSYS.LIB file system in
    either NAMEFMT 0 or NAMEFMT 1. These give the same result:

    NAM 0
    put mylib/qclsrc.someclpgm

    and

    NAM 1
    put /qsys.lib/mylib.lib/qclsrc.file/someclpgm.mbr

    However, it can be easier in NAMEFMT 1 if you are FTPing from a PC
    because that naming format is natural for the PC.

    One other detail... You don't actually have to specify either naming
    format. The format will be set automatically when the first subcommand
    uses one format or the other.

    E.g., if your first subcommand is:

    CD QGPL

    ....the session will begin in NAM 0. But if it's:

    CD /QSYS.LIB/QGPL.LIB

    ....then it should start running as NAM 1.

    Personally, I never trust it though.

    --
    Tom Liotta
    http://zap.to/tl400

  19. Re: How to write a saved file to IFS

    Peter Kinsman wrote:

    > Reading your last paragraph, does the reference to a virtual LAN mean that
    > LPARs operate in much the same way as guest 36 machines used to?


    Peter:

    Somehow, I managed almost totally to miss the entire S/36 experience.
    S/3, S/32, S/34, S/38... but was simply never where S/36 was in use.
    Once the S/38 concepts took hold, I had no interest in any other path.
    Those opportunities led me right past S/36.

    We'll have to watch for someone else to comment.

    Sorry.

    > "Tom Liotta" wrote in message
    > news:OcCdnRuAdYeHhJPbnZ2dnUVZ_uCinZ2d@centurytel.n et...
    >>
    >> The different LPARs don't know each other as anything but different
    >> systems. There's no reason they'd try to reach each other through the
    >> virtual LAN except if you used the virtual addressing.


    --
    Tom Liotta
    http://zap.to/tl400

  20. Re: How to write a saved file to IFS

    ..
    FWiW: After having found out about the error for failing to
    pre-create the save file [either by a user requested CRTSAVF or by
    having used the appropriate name format in FTP & specifying a target
    ..SAVF extension,] for the FTP PUT, such that the request effected a 528
    byte record length program described file to put the data, can be
    'recovered from' on the target system *without* having to PUT the data
    again from its original source [if the file was put in BINary].
    At system TargetSys issue FTP TargetSys and issue a new PUT request
    with the proper invocation, to send the data from the database flat file
    to a save file; re proper: depending on naming format, PUT either into a
    pre-created save file, or naming that ensures FTP does the pre-create
    for your PUT request as other posts clarify.

    Regards, Chuck
    -- All comments provided "as is" with no warranties of any kind whatsoever.

    Graybeard wrote:
    <>
    >> Oddly enough, i was just trying to ftp a savf tonight from one LPAR to
    >> another and found that ftp wanted to transfer the file in binary image
    >> format and that the resulting file on the other LPAR was no longer
    >> listed as a savf and would not restore.
    >>
    >> I later figured out how to use SAVRSTOBJ to send it to the other
    >> partition, but i am wondering what was going on, and how one would (if
    >> one can) go about ftp-ing a savf in this kind of circumstance. Any
    >> wisdom?
    >>
    >> --
    >> theron tlx
    >> (compose-mail (concat "thorne@" (rot13 "gvzoeny") ".net"))- Hide quoted text -
    >>
    >> - Show quoted text -

    >
    > Try creating a SAVF on the target system. Then run the FTP to the
    > SAVF.
    >


+ Reply to Thread