My solution was to create a flat file on the fly to copy the DB file to with FMTOPT(*NOCHK) and then copy the flat file to the IFS as the backup.
There are probably more appropriate tools, but this is working.
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Therrien, Paul via MIDRANGE-L
Sent: Wednesday, October 26, 2022 10:31 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Therrien, Paul <ptherrien@xxxxxxxxxxx>
Subject: RE: CPYTOIMPF and numeric field lengths
Thanks Scott
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Scott Klement
Sent: Wednesday, October 26, 2022 10:20 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: CPYTOIMPF and numeric field lengths
This sounds like the normal and expected behavior to me? CPYTOIMPF formats numbers as text, which means there needs to be extra space for things like the decimal point and sign.
If you are looking for the raw bytes in the record rather than a text format suitable for import into other databases, then CPYTOIMPF is the wrong tool.
On 10/26/2022 9:11 AM, Therrien, Paul via MIDRANGE-L wrote:
I am executing a CPYTOIMPF from a database file to the IFS in to get a
flat file (FIXED length fields)
I have 2 numeric fields:
W1SDTE Zoned 8, 0
W1RQVQ Zoned 9, 0
This is the command:
CPYTOIMPF FROMFILE(PJTTEST/ANACMP001 ANACMPFL)
TOSTMF(PJTTEST_20221026_001.txt)
MBROPT(*REPLACE)
RCDDLM(*CRLF)
DTAFMT(*FIXED)
NUMFLDPAD(*ZERO)
The numeric fields are being put into the flat file with 2 extra bytes.
20221001 => 0020221001
(8,0) comes out as length 10.
000000001 => 00000000001
(9,0) comes out as Length 11.
Why?
Can this be fixed with the CPTTOIMPF? Or should I use another command or function.
This is not a 1-off task, I am building a backup procedure on the IBM I to backup files to the IFS before FTPing them to remote locations.
Paul Therrien
Ext: 2230
ptherrien@xxxxxxxxxxx<mailto:ptherrien@xxxxxxxxxxx>
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.