not sure if this is the proper thread to put this but here we go....
I am a total noob when comes to as/400. I come from .NET C# windows development but need to leanr RPG IV/LIE and I am learning on the job.
IBM is totally foreign to me. currently I am going through self learning course from ATS (audio and books system IBM certified)
I decided to try and recreate some of the automation processes I had setup in DOS/Windows/SQL server for internal file processing, as a way to see how things work in real life as opposed to what is in the book. I do learn better when I solve real world problems.
so here is the scenario:
1. I have a set of batch files and SQL stored procedures setup to process/transform incoming CSV files into different format csv files that later get imported into IBM system(since the import into IBM is not yet working there is nothing to break at the moment)
what the process entails :
A. a batch script set on timer in windows server go to client FTP every 15 min and picks up any and all CSV files it can find in the folder (the location is login based . the login gets you into main folder, than cds into ..\live\orders\ folder and mget all files locally)
B. when ftp process is done, batch process gets a listing of the current folder and outputs it into text file ("dir /a /b >> allfoundfiles.txt")
C. than batch calls anouther batch that creates and executes the ftp script using "allfoundfiles.txt" as input to move all files that have been downloaded
into processed folder on the remote server. reason for doing it this way is to ensure that if any new files have been created in between the time that mget
was called and now they will remain in the folder on the server and will be processed in 15 min. so the ftp script is based on individual file name.
D. than all files in local folder are moved onto network share to be processed by a job on SQL server as needed. usually the job runs every 5 min and checks if there are any files to process. if not it is done, else it kicks the transformation routine.
the transformation routine is setup on mssql server as a series of stored procedures and tables.
it was created to be used as both a transformation job to move all info to IBM OMS and to be used in the future to feed the orders into the new .NET OMS.
as .NET OMS project is out at the moment all is left is file transformation for IBM OMS.
2. we are building an import system in IBM to pick up the files generated in #1 and process the info into IBM OMS.
I want to streamline the process and eliminate most of the steps from #1 process and move them into AS/400.
WHAT I NEED TO ACCOMPLISH:
1. eliminate the ftp batch. I know as/400 can do FTP directly thus why not do that locally
2. take all files we get from step 1 and import them into PF.
3. run some additional process to set up the data for further processing
WHAT MY LIMITATIONS and issues :
I can not use IFS. maybe later I will be able to do that but for now the system will not allow me to do that. and the consultant we hire to help with system move
(from old system38 to new ISeries) does not like to work with IFS thus no help there.
I am a noob and need easy to understand instructions.
I have search the web and this forum and all help and examples I found so far use IFS or on the level that I can not understand them fully for them to be useful for me at the moment
all my files are CSV with various length data.
all my files have a header.
I get 2 files per order
1 file header contains data that is unique per order i.e. customer id, name,PO, address etc.
1 file with order details as in actual ordered items and related data per item.
each file name follows a pattern but is unique as it includes order number.
the patter is "order_<order number>_header.csv" , "order_<order number>_details.csv"
WHAT I TRIED:
A. I have setup a Lib OrderProcess in the IBM
B. I have created a final tables to hold processed data
ORDHEADER and ORDDETAILS accordingly.
with proper field names and format as needed.
C. I can FTP/Get a single file, at least manually , into the lib but multiple mget fails as system creates members with name like "order_0000"
since name lenght is limited to 10 char all files would get the same name as at the moment the order number is under 5 char and gets cut off.
so as a test I ftp single file as HDR1 object
D. I tired to use CPYFRMIMPF FROMFILE(OrderProcess/HDR1) TOFILE(OrderProcess/HDRPROC)
but get an error and no data is copied.
the HDRPROC is a new PF I created with all alpha fields thinking that maybe some data can not be converted directly to proper format and I
will create some program to take the data from there and move it to real table. but it did not work either. so I am stuck and decided to ask for help here.
so far when using the cpyfrmimpf I got errors : 11,3,4,7 in various combinations.
any and all suggestions will be appreciated....
data is comma dellimminated and all string values are quoted.
I am a total noob when comes to as/400. I come from .NET C# windows development but need to leanr RPG IV/LIE and I am learning on the job.
IBM is totally foreign to me. currently I am going through self learning course from ATS (audio and books system IBM certified)
I decided to try and recreate some of the automation processes I had setup in DOS/Windows/SQL server for internal file processing, as a way to see how things work in real life as opposed to what is in the book. I do learn better when I solve real world problems.
so here is the scenario:
1. I have a set of batch files and SQL stored procedures setup to process/transform incoming CSV files into different format csv files that later get imported into IBM system(since the import into IBM is not yet working there is nothing to break at the moment)
what the process entails :
A. a batch script set on timer in windows server go to client FTP every 15 min and picks up any and all CSV files it can find in the folder (the location is login based . the login gets you into main folder, than cds into ..\live\orders\ folder and mget all files locally)
B. when ftp process is done, batch process gets a listing of the current folder and outputs it into text file ("dir /a /b >> allfoundfiles.txt")
C. than batch calls anouther batch that creates and executes the ftp script using "allfoundfiles.txt" as input to move all files that have been downloaded
into processed folder on the remote server. reason for doing it this way is to ensure that if any new files have been created in between the time that mget
was called and now they will remain in the folder on the server and will be processed in 15 min. so the ftp script is based on individual file name.
D. than all files in local folder are moved onto network share to be processed by a job on SQL server as needed. usually the job runs every 5 min and checks if there are any files to process. if not it is done, else it kicks the transformation routine.
the transformation routine is setup on mssql server as a series of stored procedures and tables.
it was created to be used as both a transformation job to move all info to IBM OMS and to be used in the future to feed the orders into the new .NET OMS.
as .NET OMS project is out at the moment all is left is file transformation for IBM OMS.
2. we are building an import system in IBM to pick up the files generated in #1 and process the info into IBM OMS.
I want to streamline the process and eliminate most of the steps from #1 process and move them into AS/400.
WHAT I NEED TO ACCOMPLISH:
1. eliminate the ftp batch. I know as/400 can do FTP directly thus why not do that locally
2. take all files we get from step 1 and import them into PF.
3. run some additional process to set up the data for further processing
WHAT MY LIMITATIONS and issues :
I can not use IFS. maybe later I will be able to do that but for now the system will not allow me to do that. and the consultant we hire to help with system move
(from old system38 to new ISeries) does not like to work with IFS thus no help there.
I am a noob and need easy to understand instructions.
I have search the web and this forum and all help and examples I found so far use IFS or on the level that I can not understand them fully for them to be useful for me at the moment
all my files are CSV with various length data.
all my files have a header.
I get 2 files per order
1 file header contains data that is unique per order i.e. customer id, name,PO, address etc.
1 file with order details as in actual ordered items and related data per item.
each file name follows a pattern but is unique as it includes order number.
the patter is "order_<order number>_header.csv" , "order_<order number>_details.csv"
WHAT I TRIED:
A. I have setup a Lib OrderProcess in the IBM
B. I have created a final tables to hold processed data
ORDHEADER and ORDDETAILS accordingly.
with proper field names and format as needed.
C. I can FTP/Get a single file, at least manually , into the lib but multiple mget fails as system creates members with name like "order_0000"
since name lenght is limited to 10 char all files would get the same name as at the moment the order number is under 5 char and gets cut off.
so as a test I ftp single file as HDR1 object
D. I tired to use CPYFRMIMPF FROMFILE(OrderProcess/HDR1) TOFILE(OrderProcess/HDRPROC)
but get an error and no data is copied.
the HDRPROC is a new PF I created with all alpha fields thinking that maybe some data can not be converted directly to proper format and I
will create some program to take the data from there and move it to real table. but it did not work either. so I am stuck and decided to ask for help here.
so far when using the cpyfrmimpf I got errors : 11,3,4,7 in various combinations.
any and all suggestions will be appreciated....
data is comma dellimminated and all string values are quoted.
Comment