<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cobol Compressed Packed Decimal Conversion in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40213#M10398</link>
    <description>You don't mention OS but I'm thinking Windows, where the default is files that use "control character" to delimit records.  This is fine for reading most data but when the data can have any value from 00x to FFx there can be problems.  There are two ways in SAS that I know of to ignore record markers.  RECFM = N or F.  I think you need RECFM=F because you mention records and COBAL and record length.  So on the FILENAME statement or the INFILE statement you need RECFM=F and LRECL=&lt;VALUE&gt;.  The following example although contrived and cryptic illustrates the difference that these options can make.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
830  filename FT44F001 temp;&lt;BR /&gt;
831  data _null_;&lt;BR /&gt;
832     file FT44F001;&lt;BR /&gt;
833     do x = '00'x,'1A'x;&lt;BR /&gt;
834        put 'Hello' x $1.;&lt;BR /&gt;
835        put x $1. 'hello';&lt;BR /&gt;
836        end;&lt;BR /&gt;
837     run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The file FT44F001 is:&lt;BR /&gt;
      File Name=C:\DOCUME~1\userid\LOCALS~1\Temp\SAS Temporary Files\_TD3336\#LN00024,&lt;BR /&gt;
      RECFM=V,LRECL=256&lt;BR /&gt;
&lt;BR /&gt;
NOTE: 4 records were written to the file FT44F001.&lt;BR /&gt;
      The minimum record length was 6.&lt;BR /&gt;
      The maximum record length was 6.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.01 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
838  Confusion:&lt;BR /&gt;
839  data _null_;&lt;BR /&gt;
840     infile FT44F001;&lt;BR /&gt;
841     input;&lt;BR /&gt;
842     list;&lt;BR /&gt;
843     run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The infile FT44F001 is:&lt;BR /&gt;
      File Name=C:\DOCUME~1\userid\LOCALS~1\Temp\SAS Temporary Files\_TD3336\#LN00024,&lt;BR /&gt;
      RECFM=V,LRECL=256&lt;BR /&gt;
&lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;BR /&gt;
&lt;BR /&gt;
1   CHAR  Hello. 6&lt;BR /&gt;
    ZONE  466660&lt;BR /&gt;
    NUMR  85CCF0&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;BR /&gt;
&lt;BR /&gt;
2   CHAR  .hello 6&lt;BR /&gt;
    ZONE  066666&lt;BR /&gt;
    NUMR  085CCF&lt;BR /&gt;
3         Hello 5&lt;BR /&gt;
NOTE: 3 records were read from the infile FT44F001.&lt;BR /&gt;
      The minimum record length was 5.&lt;BR /&gt;
      The maximum record length was 6.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
844  Bliss:&lt;BR /&gt;
845  data _null_;&lt;BR /&gt;
846     infile FT44F001 recfm=f lrecl=8;&lt;BR /&gt;
847     input;&lt;BR /&gt;
848     list;&lt;BR /&gt;
849     run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The infile FT44F001 is:&lt;BR /&gt;
      File Name=C:\DOCUME~1\userid\LOCALS~1\Temp\SAS Temporary Files\_TD3336\#LN00024,&lt;BR /&gt;
      RECFM=F,LRECL=8&lt;BR /&gt;
&lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;BR /&gt;
&lt;BR /&gt;
1   CHAR  Hello...&lt;BR /&gt;
    ZONE  46666000&lt;BR /&gt;
    NUMR  85CCF0DA&lt;BR /&gt;
&lt;BR /&gt;
2   CHAR  .hello..&lt;BR /&gt;
    ZONE  06666600&lt;BR /&gt;
    NUMR  085CCFDA&lt;BR /&gt;
&lt;BR /&gt;
3   CHAR  Hello...&lt;BR /&gt;
    ZONE  46666100&lt;BR /&gt;
    NUMR  85CCFADA&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;BR /&gt;
&lt;BR /&gt;
4   CHAR  .hello..&lt;BR /&gt;
    ZONE  16666600&lt;BR /&gt;
    NUMR  A85CCFDA&lt;BR /&gt;
NOTE: 4 records were read from the infile FT44F001.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;/VALUE&gt;</description>
    <pubDate>Thu, 14 Jan 2010 13:09:57 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2010-01-14T13:09:57Z</dc:date>
    <item>
      <title>Cobol Compressed Packed Decimal Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40209#M10394</link>
      <description>I'm importing a file from Cobol into SAS and am encountering a problem with two packed decimal fields in the conversion.  As the fields are read in, some of the unpacked results read out to the equivalent of hex values 00 or 1A, and therefore my data step thinks it is at the end of a row prematurely.  Is there any simple way to either a) simply skip over these fields when reading the file into SAS or b)Tell SAS to disregard the hex equivalents for those fields so each line goes to the full lrecl?</description>
      <pubDate>Thu, 14 Jan 2010 02:45:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40209#M10394</guid>
      <dc:creator>myoung27</dc:creator>
      <dc:date>2010-01-14T02:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Cobol Compressed Packed Decimal Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40210#M10395</link>
      <description>Hi:&lt;BR /&gt;
  My COBOL days are a bit behind me -- several jobs ago, but this note about the correct INFORMATS and how they correspond to COBOL PIC definitions may be useful:&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/3/714.html" target="_blank"&gt;http://support.sas.com/kb/3/714.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
  Before you assume that the problem is in the data, I would be sure that you are using the correct INFORMAT on the SAS side to read the data. Here's some more information on reading binary and packed decimal data:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a003209921.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a003209921.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 14 Jan 2010 03:30:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40210#M10395</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-01-14T03:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Cobol Compressed Packed Decimal Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40211#M10396</link>
      <description>Are you dealing with fixed or variable block files?&lt;BR /&gt;
&lt;BR /&gt;
Anyway, please share with us the code you are using to import the file.&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Thu, 14 Jan 2010 09:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40211#M10396</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2010-01-14T09:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Cobol Compressed Packed Decimal Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40212#M10397</link>
      <description>Also, on what OS are running SAS?  What OS does your data originate and how is it created?  If the two OS platforms are not the same, how do you transfer (FTP, IND$FILE, and with what parameters) the data from the originating OS platform to the OS platform where you are running SAS to process the data?  It would be most useful if you posted a REPLY with the SAS log pasted in it, for others to review -- also with all of your DATA and/or PROC step code revealed.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 14 Jan 2010 13:05:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40212#M10397</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-14T13:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Cobol Compressed Packed Decimal Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40213#M10398</link>
      <description>You don't mention OS but I'm thinking Windows, where the default is files that use "control character" to delimit records.  This is fine for reading most data but when the data can have any value from 00x to FFx there can be problems.  There are two ways in SAS that I know of to ignore record markers.  RECFM = N or F.  I think you need RECFM=F because you mention records and COBAL and record length.  So on the FILENAME statement or the INFILE statement you need RECFM=F and LRECL=&lt;VALUE&gt;.  The following example although contrived and cryptic illustrates the difference that these options can make.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
830  filename FT44F001 temp;&lt;BR /&gt;
831  data _null_;&lt;BR /&gt;
832     file FT44F001;&lt;BR /&gt;
833     do x = '00'x,'1A'x;&lt;BR /&gt;
834        put 'Hello' x $1.;&lt;BR /&gt;
835        put x $1. 'hello';&lt;BR /&gt;
836        end;&lt;BR /&gt;
837     run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The file FT44F001 is:&lt;BR /&gt;
      File Name=C:\DOCUME~1\userid\LOCALS~1\Temp\SAS Temporary Files\_TD3336\#LN00024,&lt;BR /&gt;
      RECFM=V,LRECL=256&lt;BR /&gt;
&lt;BR /&gt;
NOTE: 4 records were written to the file FT44F001.&lt;BR /&gt;
      The minimum record length was 6.&lt;BR /&gt;
      The maximum record length was 6.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.01 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
838  Confusion:&lt;BR /&gt;
839  data _null_;&lt;BR /&gt;
840     infile FT44F001;&lt;BR /&gt;
841     input;&lt;BR /&gt;
842     list;&lt;BR /&gt;
843     run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The infile FT44F001 is:&lt;BR /&gt;
      File Name=C:\DOCUME~1\userid\LOCALS~1\Temp\SAS Temporary Files\_TD3336\#LN00024,&lt;BR /&gt;
      RECFM=V,LRECL=256&lt;BR /&gt;
&lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;BR /&gt;
&lt;BR /&gt;
1   CHAR  Hello. 6&lt;BR /&gt;
    ZONE  466660&lt;BR /&gt;
    NUMR  85CCF0&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;BR /&gt;
&lt;BR /&gt;
2   CHAR  .hello 6&lt;BR /&gt;
    ZONE  066666&lt;BR /&gt;
    NUMR  085CCF&lt;BR /&gt;
3         Hello 5&lt;BR /&gt;
NOTE: 3 records were read from the infile FT44F001.&lt;BR /&gt;
      The minimum record length was 5.&lt;BR /&gt;
      The maximum record length was 6.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
844  Bliss:&lt;BR /&gt;
845  data _null_;&lt;BR /&gt;
846     infile FT44F001 recfm=f lrecl=8;&lt;BR /&gt;
847     input;&lt;BR /&gt;
848     list;&lt;BR /&gt;
849     run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The infile FT44F001 is:&lt;BR /&gt;
      File Name=C:\DOCUME~1\userid\LOCALS~1\Temp\SAS Temporary Files\_TD3336\#LN00024,&lt;BR /&gt;
      RECFM=F,LRECL=8&lt;BR /&gt;
&lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;BR /&gt;
&lt;BR /&gt;
1   CHAR  Hello...&lt;BR /&gt;
    ZONE  46666000&lt;BR /&gt;
    NUMR  85CCF0DA&lt;BR /&gt;
&lt;BR /&gt;
2   CHAR  .hello..&lt;BR /&gt;
    ZONE  06666600&lt;BR /&gt;
    NUMR  085CCFDA&lt;BR /&gt;
&lt;BR /&gt;
3   CHAR  Hello...&lt;BR /&gt;
    ZONE  46666100&lt;BR /&gt;
    NUMR  85CCFADA&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;BR /&gt;
&lt;BR /&gt;
4   CHAR  .hello..&lt;BR /&gt;
    ZONE  16666600&lt;BR /&gt;
    NUMR  A85CCFDA&lt;BR /&gt;
NOTE: 4 records were read from the infile FT44F001.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;/VALUE&gt;</description>
      <pubDate>Thu, 14 Jan 2010 13:09:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cobol-Compressed-Packed-Decimal-Conversion/m-p/40213#M10398</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-01-14T13:09:57Z</dc:date>
    </item>
  </channel>
</rss>

