2,555 pts.
 From sourcefile to IFS and back..
I want to use CPYTOSTMF and CPYFRMSTMF commands to copy sourcemember to and fro the IFS. To test functionality, I created the following test:

Sourcemember A_1.TXT :

 

 FMT ** ...+... 1 ...+... 2 ...+... 3 ...+...

             *************** Beginning of data ****

0001.00 123456789_line number 1

0002.00 123456789_line number 2

0003.00 123456789_line number 3

             ****************** End of data *******


Copy above sourcemember to IFS:



CPYTOSTMF FROMMBR('/qsys.lib/mylib.lib/QALLSRC.file/A_1.mbr') TOSTMF('/temp/A_1.RPGLE') CVTDTA(*NONE) STMFCCSID(*PCASCII) ENDLINFMT(*CRLF)



(.. so far, so good :-)) ..

and back as sourcemember A_2 :



CPYFRMSTMF FROMSTMF('/temp/A_1.rpgle') TOMBR('qsys.lib/mylib.lib/qallsrc.file/A_2.mbr') MBROPT(*REPLACE) STMFCCSID(277)



RESULT:

 

 FMT ** ...+... 1 ...+... 2 ...+... 3 ..

             *************** Beginning of data

0001.00 123456789_line number 1

0002.00  123456789_line number 2

0003.00  123456789_line number 3

0004.00

           ****************** End of data **



Ooups.. line 2 and 3 are indented one character, and an extra line (4) has been added !!!!

Let's look a the new sourcemember with

'DSPPFM FILE(ADFO2SIMI/QALLSRC) MBR(A_2)' + F10 + F11:



 *...+....1....+....2....+....3....+....4...

000100000000123456789_line number 1 FFFFFFFFFFFFFFFFFFFFF6989849A98894F44444444 000100000000123456789D395505442590100000000

000200000000�123456789_line number 2 FFFFFFFFFFFF0FFFFFFFFF6989849A98894F4444444 000200000000A123456789D39550544259020000000

000300000000�123456789_line number 3 FFFFFFFFFFFF0FFFFFFFFF6989849A98894F4444444 000300000000A123456789D39550544259030000000

000400000000�

FFFFFFFFFFFF0444444444444444444444444444444 000400000000A000000000000000000000000000000



As can be seen, a hex 0A (position 13 in records 2,3 and 4) is the problem. What did I do wrong ?



Software/Hardware used:
9407/M15 running OS v6r1m0
ASKED: September 2, 2009  7:28 AM
UPDATED: September 3, 2009  1:37 PM

Answer Wiki:
DanTheDane 100 pts. | Sep 2 2009 2:15PM GMT Through expriments, I succeded to solve this probl myself. Here are the two commandstrings that solved the problem: CPYTOSTMF FROMMBR(’/qsys.lib/mylib.lib/QALLSRC.file/A_1.mbr’) TOSTMF(’/temp/A_1.txt’) CVTDTA(*NONE) STMFCCSID(*PCASCII) ENDLINFMT(*CR) CPYFRMSTMF FROMSTMF(’//temp/A_1.txt’) TOMBR(’qsys.lib/mylib.lib/qallsrc.file/A_2.mbr’) MBROPT(*REPLACE) STMFCCSID(277) Thanks for any thoughts and comment :-) _________________________________________________________________- Perhaps you should use End of line characters . . . . . *CRLF on the CPYFRMSTMF Phil ----------------------- Sure - you're solution works .. unless you edit this code using pc editors - not that you should. They will add CRLF when you press the enter key. Phil ----------------------------- There is something attractive about having it in readable format. Only alternative I can think of is FTPing a SaveFile -- but I'm don't know if that would have version/revision issues. Phil -----------------------------
Last Wiki Answer Submitted:  September 2, 2009  7:37 pm  by  ITKE   16,755 pts.
All Answer Wiki Contributors:  ITKE   16,755 pts. , philpl1jb   44,630 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Through expriments, I succeded to solve this probl myself. Here are the two commandstrings that solved the problem:

CPYTOSTMF FROMMBR('/qsys.lib/mylib.lib/QALLSRC.file/A_1.mbr')
          TOSTMF('/temp/A_1.txt')
          CVTDTA(*NONE)
          STMFCCSID(*PCASCII)
          ENDLINFMT(*CR)
 CPYFRMSTMF FROMSTMF('//temp/A_1.txt')
           TOMBR('qsys.lib/mylib.lib/qallsrc.file/A_2.mbr')
           MBROPT(*REPLACE)
           STMFCCSID(277)

Thanks for any thoughts and comment :-)

 2,555 pts.

 

Do you mind if I ask why you want to do this?

Just curious.

 1,130 pts.

 

to Littlepd and others.

I want to create a source transfer solution that can ease the task of having to work with 10+ systems with 5 different releases of os/400, and 3 different type of tapesystems . I hope to be able to attach IFS-files to an email, sebd it and save etcc vice versa.
Any other ideas?
PS: I am working as a consultant.

 2,555 pts.

 

Have you considered looking at WDSC?

 2,280 pts.