• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Re: FTP problem

Re: FTP problem

Hello Michael,

I am sending you this option, assuming that you have X12-EDI.
If you have EDIFACT, or ODETTE or something else,
or not ISA/IEA enveloping, call me.

This is a RPGIII solution because mostly everybody knows it.
If you need a RPG400 version, call me.
/////////////////////////////////////////////////////////
F* Let get your file in the "one record file the size of the EDI file" kind.
F* Next is the input file definition of that file, as it came via FTP from
NT.
F* I assume that you do not receive an envelope greater that 9999 bytes;
F* if you do receive it, call me.
FFROMNT IF F 9999 DISK
F*
F* Let create an output file of 256 characters long records.
F* This is the output file definition, remember, in QTEMP, temporary.
FUNWRAPD O F 256 DISK UC
I*
I* Let define data storage areas.
IFROMNT NS
I 19999 IFIELD
IDS256 DS 256
I*
I*Let define some constants.
I "CRTPF QTEMP/UNWRAPD - C C01
I " RCDLEN(256) -
I " SIZE(*NOMAX) "
I " CLRPFM UNWRAPD" C C02
I* Let go ahead with the C statements.
C* After these statements you'll have your output file.
C CALL "QCMDEXC" LR =LessThan
C PARM C01 X50
C PARM 50 L155
C LR RETRN
C CALL "QCMDEXC" LR
C PARM C02 X50 50
C PARM 14 L155 155
C LR RETRN
C OPENUNWRAPD LR =LessThan
C LR RETRN
C* I will let you check it out in case of
C* an error (LR) in previous statements.
C* If everything went well, now the output file shell is in QTEMP.
C*
C* Now, read the FTPed whole long record envelope.
C READFROMNT
LR
C LR RETRN
C* This previous RETRN statement is only precautionary because
C* if everything goes well, you will never receive an empty file, right?
C*
C* Let find what your partner uses.
C 1 SUBST IFIELD:4 FS 1
C DO 15
C FS SCAN IFIELD:I I 70
C ADD 1 I
C END
C 1 SUBSTIFIELD:I SS 1
C* Now you have the ISA16 in SS.
C*
C* We are ready to start parsing.
C Z-ADD1 ES 70
C DO *HIVAL NR 70
C Z-ADDES P1 70
C SS SCAN IFIELD:p1 ES LR
=LessThan
C LR RETRN
C* If LR comes along, you will have already your segments parsed.
C* No need to do anything else, then RETRN.
C*
C ADD 1 ES
C ES SUB P1 SL 30
C SL SUBSTIFIELD:p1 DS256
C WRITEUNWRAPD DS256
C END
C* After these run, you will have NR segments in your QTEMP/UNWRAPD file, I
think.
C* Next step is for you to handle QTEMP/UNWRAPD as you need.
/////////////////////////////////////////////////////////
I am working in a Unix box right now, then I am writing these lines from the
top of my head. If I have an error, sorry, but I think that you got the idea
now.
/////////////////////////////////////////////////////////
Regards,

Luis Brignolo.

AS400, Unix, EDI, JDE consultant.
(718)845-6777
 
Top