Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving source members

Status
Not open for further replies.

PeteJohnston

Programmer
Nov 6, 2002
291
0
0
GB
I'm looking for a way to save source members into text files that I can save easily without using save files. I've had a problem in the past in shops that don't allow RSTLIB or RSTOBJ when I'm trying to restore sample program sources (just to make life easier). I'm sure I heard somewhere of someone using XML or something similar to save all of the sources in a source file. Can anyone point me in the right direction?

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
Is FTP set up so you can transfer between your PC and the '400?
 
Yes it is. I've tried using the FTP command MGET to do a multiple get of members in a file. The problem with this is that when I use MPUT to transfer them back to the 400 it has lost the member text and attributes. Unless I then go thru them all to type in the member text and attribute (ie. RPGLE, CL, DDS...) for all of them then it would be close to impossible to recompile them.

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
That is not true. You only lost the attributes if you are moving the member into an entirely new source file. We are doing this all the time and only new members have no attributes which you have to supply.

Here's how we migrate lots of files/programs etc to or from AS/400 using a simple ftp:
1. Create a .bat file with the following entry

@echo Please wait transfer in progress.........
ftp -n -s:C:\data\MyFtp.txt HostName > c:\data\FtpOut.log
notepad C:\data\FtpOut.log

note: HostName is your AS400 name or ip address.

2. In your c:\data directory create a text file called MyFtp.txt using notepad and has the following entries. This
file is the only one you will have to change everytime you need to transfer something and everytime there is a change of your password in AS400:

user YourUserID
YourPassword
ascii
get Library/source.memberName1 c:\data\memberName1
get library/source.memberName2 c:\data\memberName2
put c:\data\AnotherMember library/source.AnotherMember
quit

note you can have as many put or get. Use ; to rem out
lines that is not needed. Then just click you .bat file
to run the script.

 
I tried what you suggested. If I do it for an existing member it's fine. If it doesn't already exist then the copied member has a blank attribute and text. Does that mean that the members have to exist in the source files before I FTP them? If I do then this won't work for me because I'm hoping to use it to copy about 150 sources down to a set of .txt files so that I can copy them back whenever I go to a different machine without having to do a restore. They will never exist on the new machine.

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
We have AS400 for each hospitals and we use Aldon'e affinity to distribute our codes to each system. If what you mean is moving a lot of source members into a different box then you are better off using SAVLIB and RSTLIB. As400 is the best place to be the repository of all programs because of each capability to edit different program types.

These hosts communicate with each other and it is easy for us to distribute any objects.
 
Is I have mentioned previously you can use SNDNETF/WRKNETF
command to send your sources to a different AS400 machine as long as you are setup(enabled) to do so. Ask your system admin about setting you up.

 
I'm a contract software developer and move from customer to customer frequently. You may find it surprising how many sites are not happy to let you use RSTOBJ or RSTLIB to restore some unknown software onto their beloved machines. I was hoping to save the sources as a set of .txt files in order to get around this. When I arrive at a new customer I can just FTP them to the AS400 and hey-presto I have my utilities and skeleton programs ready to use. SNDNETF doesn't really work here, especially as the customer might not be happy at me sending things in a save file to another organisation. I don't think the system administrator is likely to set up this kind of link just for my benefit.

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
I can see Pete's problem.

I wish I'd thought of bringing the sources for some of the handy utilities we had at my old shop which don't exist at my current place...

Could you do a DSPFD of your source file(s) to an outfile, specifying type *MBRLIST, take this file with you as well and write a utility which would refer to the outfile to restore the member attributes when you get your sources back up to the AS400?

Or am I talking rubbish?
(always a possibility with me...)
 
I found the following 2 tools at the link below that may help you.

XMLGEN - Generate XML download members.
This utility offers a truly convenient way to package source code and object creation instructions of all objects required for a utility or application. Output is a well-formed, valid XML document with the Document Type Definition and XML parser/installer program embedded in the text.

XMLSRCFIL - All source file mbrs to single XML mbr.
This utility places all members from a selected source file into a single well-formed XML mbr complete with all the information required to recreate your source members on another system. Note: XMLGEN utility a prerequisite.


I remember one of the magazines publishing a PKGSRCMBR command years ago that also included a command for unpacking. I have used it several times in the past.



T. Bishop
 
Update:
I found the source for the Package Source Member and Extract Source Member commands.
Shoot me an e-mail from my website, in my signature, and I will send you the ZIP file.
This tool packages an entire source file into one source member which you can FTP down to your PC.
Then FTP the EXTSRCMBR sources and the "package" onto the next AS/400 and use the EXTSRCMBR command to extract the source members. Retains the member types and descriptions.

T. Bishop
 
I've written some code that embeds the type and text in each source member and then uses this to change the source member when I restore them. If the PKGSRCMBR code is available that would be good too.

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top