Date: Mon, 13 Dec 2004 10:26:30 -0800
Reply-To: Jeff Voeller <Jeff.Voeller@MCI.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jeff Voeller <Jeff.Voeller@MCI.COM>
Subject: Re: Help on INPUT file with packed decimal format
In-Reply-To: <20041213181638.25910.qmail@web81008.mail.yahoo.com>
Content-type: text/plain; charset=us-ascii
I've never had to do this, so I can't be sure it works, but I think you can
read the character fields after a binary FTP transfer by using the $EBCDICw.
informat.
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Dennis
Diskin
Sent: Monday, December 13, 2004 10:17 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Help on INPUT file with packed decimal format
Dennis Diskin <diskin@snet.net> wrote:Ben,
I suspect that the problem is that the FTP process is translating from
EBCDIC to ASCII, but when the packed (or any binary) fields are translated,
they become meaningless.
I haven't done this in a few years, but one approach is to read the data
twice, first to get the character fields that need to be translated and then
as a binary file (an FTP parameter) to gaet the packed/binary/zoned fields.
Then you just do a one to one merge of the records.
HTH,
Dennis Diskin
"Krone, Ben --- Senior Manager - Operations System --- GO"
<Ben.Krone@FREIGHT.FEDEX.COM> wrote:
Greetings,
I am working on converting a SAS program that is currently running on
MVS to run on my pc. I have hit a snag in that one of the files I am
using has data stored as packed decimal. I am attempting to read the
file in using an FTP fileref, which is working but SAS is complaining
when I hit the PDw.d informats. I am guessing that these informats are
not valid in the PC world, but not sure what alternate I should use, or
if this is even doable.
I have included some information from the log below (IP, etc deleted)
and would appreciate any help.
Thanks
Ben
1 filename archive ftp "'afwp.st730010.outfile(0)'"
2 host='xxxxxxxxxxx'
3 user="xxxxxxx"
4 pass="xxxxxxx"
5 debug;
6
7 data arch;
8 infile archive;
9 input @1 type $10.
10 @11 BEGIN_DT yymmdd10.
11 @21 CUSTOMER_CENTER_ID $4.
12 @25 REGION_ID $4.
13 @29 DIVISION_ID $4.
14 @33 COMPANY_ID $4.
15 @37 CATEGORY_CD $1.
16 @38 MEASURE_CD $2.
17 @40 UPDATE_COMP_FLG $1.
18 @41 NOCALC_DAY_FLG $1.
19 @42 ACTUAL_NBR pd7.2
20 @49 ACTUAL_PCT pd3.2
21 @52 GOAL_NBR pd7.2
22 @59 GOAL_PCT pd3.2
23 @62 MET_GOAL_PCT pd3.2
24 @65 AVG_HIGH_NBR pd7.2
25 @72 AVG_HIGH_PCT pd3.2
26 @75 AVG_MEAN_NBR pd7.2
27 @82 AVG_MEAN_PCT pd3.2
28 @85 AVG_LOW_NBR pd7.2
29 @92 AVG_LOW_PCT pd3.2
30 @95 OTHER_1_NBR pd7.2
31 @102 OTHER_2_NBR pd7.2;
32 run;
NOTE: 220-FTPSERVE IBM FTP CS V1R4 at , 17:49:54 on 2004-12-13.
NOTE: <<< 220-FTPSERVE IBM FTP CS V1R4 at , 17:49:54 on 2004-12-13.
NOTE: <<< 220 Connection will close if idle for more than 5 minutes.
NOTE: >>> USER XXXXXXX
NOTE: <<< 331 Send password please.
NOTE: >>> PASS XXXXXXXX
NOTE: <<< 230 XXXXXXX is logged on. Working directory is "XXXXXXX.".
NOTE: >>> PORT
NOTE: <<< 200 Port request OK.
NOTE: >>> TYPE A
NOTE: <<< 200 Representation type is Ascii NonPrint
NOTE: >>> PWD
NOTE: <<< 257 "'XXXXXXX.'" is working directory.
NOTE: >>> RETR 'afwp.st730010.outfile(0)'
NOTE: <<< 125 Sending data set AFWP.ST730010.OUTFILE.G0047V00 FIXrecfm
108
NOTE: User XXXXXXX has connected to FTP server on Host .
NOTE: The infile ARCHIVE is:
Filename='afwp.st730010.outfile(0)',
Pathname= "'XXXXXXX.'" is working directory,
Local Host Name= ,
Local Host IP addr= ,
Service Hostname Name= ,
Service IP addr= ,Service Name=FTP,
Service Portno=21,Lrecl=256,Recfm=Variable
NOTE: Invalid data for ACTUAL_NBR in line 1 42-48.
NOTE: Invalid data for ACTUAL_PCT in line 1 49-51.
NOTE: Invalid data for GOAL_NBR in line 1 52-58.
NOTE: Invalid data for GOAL_PCT in line 1 59-61.
NOTE: Invalid data for MET_GOAL_PCT in line 1 62-64.
NOTE: Invalid data for AVG_HIGH_NBR in line 1 65-71.
NOTE: Invalid data for AVG_HIGH_PCT in line 1 72-74.
NOTE: Invalid data for AVG_MEAN_NBR in line 1 75-81.
NOTE: Invalid data for AVG_MEAN_PCT in line 1 82-84.
NOTE: Invalid data for AVG_LOW_NBR in line 1 85-91.
NOTE: Invalid data for AVG_LOW_PCT in line 1 92-94.
NOTE: Invalid data for OTHER_1_NBR in line 1 95-101.
NOTE: Invalid data for OTHER_2_NBR in line 1 102-108.
RULE:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
--+----8----+-
1 CHAR DAILY 2003-10-01 501Y
.............................................
ZONE
444452222233332332332222222222222222333520000000000000000000000000000000
00000000000000
NUMR
419C9000002003D10D01000000000000000050190000000C00C000000C00C00C000000C0
0C000000C00C00
RULE:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
--+----8----+-
87 ...................... 108
ZONE 0000000000000000000000
NUMR 0000C00C000000C000000C
type=DAILY BEGIN_DT=15979 CUSTOMER_CENTER_ID= REGION_ID= DIVISION_ID=
COMPANY_ID=
CATEGORY_CD=5 MEASURE_CD=01 UPDATE_COMP_FLG=Y NOCALC_DAY_FLG=
ACTUAL_NBR=. ACTUAL_PCT=.
GOAL_NBR=. GOAL_PCT=. MET_GOAL_PCT=. AVG_HIGH_NBR=. AVG_HIGH_PCT=.
AVG_MEAN_NBR=. AVG_MEAN_PCT=.
AVG_LOW_NBR=. AVG_LOW_PCT=. OTHER_1_NBR=. OTHER_2_NBR=. _ERROR_=1 _N_=1
*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************