put unformatted to file in SCO Unix and Unixware

put unformatted to file in SCO Unix and Unixware

Post by Michael Lockwoo » Sat, 09 Oct 1999 04:00:00



I am having trouble outputing to an unformatted text file in Progress 7.3
the file looks fine for about 15 records then it throws some trash in the
output.
It picks up fine for another 15 records then does it again.  I took out some
fields and it now occurrs about every 18 records.   Is there a buffer or
paging setting that I need to set.  If I take the unformatted command
off the PUT command everything looks fine except the exact spacing the
bank wants.  I am willing to try anything.

Thanks,  Michael Lockwood

 
 
 

put unformatted to file in SCO Unix and Unixware

Post by Michael Lockwoo » Sat, 09 Oct 1999 04:00:00


Here is a sample of the output

 000075313300000138861000000^X^DM-%^VM-[^W^DM-`001131090999
 000075313300000138862000000000319090999
 000075313300000138863000000000347090999
 000075313300000138864000000000320090999
 000075313300000138865000000000323090999
 000075313300000138866000000000323090999
 000075313300000138867000000000865090999
 000075313300000138868000000000820090999
 000075313300000138869000000000346090999
 000075313300000138870000000001580090999
 000075313300000138871000000000879090999
 000075313300000138872000000000276090999
 000075313300000138873000000001400090999
 000075313300000138874000000001260090999
 000075313300000138875000000000300090999
 000075313300000138876000000000340090999
 000075313300000138877000000000250090999
 000075313300000138878000000000773090999
 000075313300000138879000000000425090999
 000075313300000138880000000000409090999
 000075313300000138881000000000250090999
 000075313300000138882000000000202090999
 000075313300000138883000000000050090999
 000075313300000138884000000000450090999
 000075313300000138885000000000450090999
 0^\^DM-%^VM-L^[^D00075313300000138886000000000600090999
 000075313300000138887000000000046090999
 000075313300000138888000000000272090999
 000075313300000138889000000000750090999
 000075313300000138890000000000833090999
 000075313300000138891000000000800090999
 000075313300000138892000000000275090999
 000075313300000138893000000000950090999

Long version with output above.

output to mikevoid.txt.

DEFINE SHARED VARIABLE qbf-total AS INTEGER NO-UNDO.
DEFINE VARIABLE qbf-001  AS CHARACTER NO-UNDO.
DEFINE VARIABLE qbf-002  AS CHARACTER NO-UNDO.
DEFINE VARIABLE qbf-003  AS CHARACTER NO-UNDO.
DEFINE VARIABLE qbf-004  AS CHARACTER NO-UNDO.
DEFINE VARIABLE qbf-005  AS CHARACTER NO-UNDO.
DEFINE VARIABLE qbf-007  AS DECIMAL NO-UNDO.

FOR EACH coinsco1.ap_recon WHERE coinsco1.ap_recon.apr_cdate >= 9/1/1999 AND
c~
oinsco1.ap_recon.apr_cdate <= 10/30/1999 NO-LOCK,
  EACH coinsco1.ap_bank WHERE abm_num = apr_bank NO-LOCK,
  EACH coinsco1.ap_vendor WHERE avm_num = apr_vendor NO-LOCK:
  ASSIGN

    qbf-001 = (if coinsco1.ap_recon.apr_vfdate = ? THEN " " ELSE "V")

    qbf-002 = "000"
    qbf-003 = SUBSTRING(coinsco1.ap_bank.abm_account,INTEGER(1),INTEGER(2))
    qbf-004 = SUBSTRING(coinsco1.ap_bank.abm_account,INTEGER(4),INTEGER(3))
    qbf-005 = SUBSTRING(coinsco1.ap_bank.abm_account,INTEGER(8),INTEGER(3))
    qbf-007 = coinsco1.ap_recon.apr_amount * 10.

PUT UNFORMATTED

    (IF coinsco1.ap_recon.apr_vfdate = ? THEN " " ELSE "V")

    (IF qbf-002 = ? THEN "?  " ELSE STRING(qbf-002,"XXX"))

    (IF qbf-003 = ? THEN "? " ELSE STRING(qbf-003,"99"))
    (IF qbf-004 = ? THEN "?  " ELSE STRING(qbf-004,"999"))

    (IF qbf-005 = ? THEN "?  " ELSE STRING(qbf-005,"999"))

    (IF coinsco1.ap_recon.apr_check = ? THEN "?         " ELSE
STRING(coinsco1.~
ap_recon.apr_check,"9999999999"))

    (IF qbf-007 = ? THEN "?           " ELSE STRING(qbf-007,"999999999999"))

    (IF coinsco1.ap_recon.apr_cdate = ? THEN "?     " ELSE
STRING(coinsco1.ap_r~
econ.apr_cdate,"999999"))

    CHR(13) CHR(10).
END.
output close.

short version of program  (does the samething)

define stream s1.
OUTPUT STREAM s1 to mikevoid.txt.
DEFINE VARIABLE accountno as CHARACTER NO-UNDO.
    for each ap_recon  where apr_cdate >= 9/1/1999,
    each ap_bank   where abm_num    = apr_bank NO-LOCK,
    each ap_vendor where avm_num    = apr_vendor NO-LOCK:

    accountno =SUBSTR(abm_account,1,2) + SUBSTR(abm_account,4,3) +
SUBSTR(abm_account,8,3).

/*    display accountno apr_check apr_amount apr_cdate avm_name.
*/
     PUT STREAM s1 UNFORMATTED
        (if apr_vfdate=? then " 000" else "V000")
        accountno
        string(apr_check,"9999999999")
        string(apr_amount * 100, "9999999999")
        "         "
        string(apr_cdate,"999999")
        string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
        "                  "
        CHR(13) CHR(10).
end.
OUTPUT STREAM s1 CLOSE.


>I am having trouble outputing to an unformatted text file in Progress 7.3
>the file looks fine for about 15 records then it throws some trash in the
>output.
>It picks up fine for another 15 records then does it again.  I took out
some
>fields and it now occurrs about every 18 records.   Is there a buffer or
>paging setting that I need to set.  If I take the unformatted command
>off the PUT command everything looks fine except the exact spacing the
>bank wants.  I am willing to try anything.

>Thanks,  Michael Lockwood


 
 
 

put unformatted to file in SCO Unix and Unixware

Post by Meneghell » Sun, 10 Oct 1999 04:00:00


Hello,

Maybe theres a control character (which code is bellow 32) in avm_name.
To clean this variable from any control character, use this code:

define variable i-counter as integer no-undo.
do i-counter = 1 to 31:
   do while index(avm_name, chr(i-counter)) > 0:
      assign substring(avm_name, index(avm_name, chr(i-counter)), 1) = " ".
   end.
end.

This code will be faster if you diminish the set of control characters you are
looking for.

I have never used chr(13) chr(10) to finish a line. Try using skip instead.
The put statement would be like this:

     PUT STREAM s1 UNFORMATTED
        (if apr_vfdate=? then " 000" else "V000")
        accountno
        string(apr_check,"9999999999")
        string(apr_amount * 100, "9999999999")
        "         "
        string(apr_cdate,"999999")
        string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
        "                  "
        skip.

Best regards.

Paulo Meneghelli Jr

--------------------------------------------


> short version of program  (does the samething)

> define stream s1.
> OUTPUT STREAM s1 to mikevoid.txt.
> DEFINE VARIABLE accountno as CHARACTER NO-UNDO.
>     for each ap_recon  where apr_cdate >= 9/1/1999,
>     each ap_bank   where abm_num    = apr_bank NO-LOCK,
>     each ap_vendor where avm_num    = apr_vendor NO-LOCK:

>     accountno =SUBSTR(abm_account,1,2) + SUBSTR(abm_account,4,3) +
> SUBSTR(abm_account,8,3).

> /*    display accountno apr_check apr_amount apr_cdate avm_name.
> */
>      PUT STREAM s1 UNFORMATTED
>         (if apr_vfdate=? then " 000" else "V000")
>         accountno
>         string(apr_check,"9999999999")
>         string(apr_amount * 100, "9999999999")
>         "         "
>         string(apr_cdate,"999999")
>         string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
>         "                  "
>         CHR(13) CHR(10).
> end.
> OUTPUT STREAM s1 CLOSE.

 
 
 

put unformatted to file in SCO Unix and Unixware

Post by Meneghell » Sun, 10 Oct 1999 04:00:00


Hello,

Maybe theres a control character (which code is bellow 32) in avm_name.
To clean this variable from any control character, use this code:

define variable i-counter as integer no-undo.
do i-counter = 1 to 31:
   do while index(avm_name, chr(i-counter)) > 0:
      assign substring(avm_name, index(avm_name, chr(i-counter)), 1) = " ".
   end.
end.

This code will be faster if you diminish the set of control characters you are
looking for.

I have never used chr(13) chr(10) to finish a line. Try using skip instead.
The put statement would be like this:

     PUT STREAM s1 UNFORMATTED
        (if apr_vfdate=? then " 000" else "V000")
        accountno
        string(apr_check,"9999999999")
        string(apr_amount * 100, "9999999999")
        "         "
        string(apr_cdate,"999999")
        string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
        "                  "
        skip.

Best regards.

Paulo Meneghelli Jr

--------------------------------------------


> short version of program  (does the samething)

> define stream s1.
> OUTPUT STREAM s1 to mikevoid.txt.
> DEFINE VARIABLE accountno as CHARACTER NO-UNDO.
>     for each ap_recon  where apr_cdate >= 9/1/1999,
>     each ap_bank   where abm_num    = apr_bank NO-LOCK,
>     each ap_vendor where avm_num    = apr_vendor NO-LOCK:

>     accountno =SUBSTR(abm_account,1,2) + SUBSTR(abm_account,4,3) +
> SUBSTR(abm_account,8,3).

> /*    display accountno apr_check apr_amount apr_cdate avm_name.
> */
>      PUT STREAM s1 UNFORMATTED
>         (if apr_vfdate=? then " 000" else "V000")
>         accountno
>         string(apr_check,"9999999999")
>         string(apr_amount * 100, "9999999999")
>         "         "
>         string(apr_cdate,"999999")
>         string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
>         "                  "
>         CHR(13) CHR(10).
> end.
> OUTPUT STREAM s1 CLOSE.

 
 
 

put unformatted to file in SCO Unix and Unixware

Post by Meneghell » Sun, 10 Oct 1999 04:00:00


Hello,

Maybe theres a control character (which code is bellow 32) in avm_name.
To clean this variable from any control character, use this code:

define variable i-counter as integer no-undo.
do i-counter = 1 to 31:
   do while index(avm_name, chr(i-counter)) > 0:
      assign substring(avm_name, index(avm_name, chr(i-counter)), 1) = " ".
   end.
end.

This code will be faster if you diminish the set of control characters you are
looking for.

I have never used chr(13) chr(10) to finish a line. Try using skip instead.
The put statement would be like this:

     PUT STREAM s1 UNFORMATTED
        (if apr_vfdate=? then " 000" else "V000")
        accountno
        string(apr_check,"9999999999")
        string(apr_amount * 100, "9999999999")
        "         "
        string(apr_cdate,"999999")
        string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
        "                  "
        skip.

Best regards.

Paulo Meneghelli Jr

--------------------------------------------


> short version of program  (does the samething)

> define stream s1.
> OUTPUT STREAM s1 to mikevoid.txt.
> DEFINE VARIABLE accountno as CHARACTER NO-UNDO.
>     for each ap_recon  where apr_cdate >= 9/1/1999,
>     each ap_bank   where abm_num    = apr_bank NO-LOCK,
>     each ap_vendor where avm_num    = apr_vendor NO-LOCK:

>     accountno =SUBSTR(abm_account,1,2) + SUBSTR(abm_account,4,3) +
> SUBSTR(abm_account,8,3).

> /*    display accountno apr_check apr_amount apr_cdate avm_name.
> */
>      PUT STREAM s1 UNFORMATTED
>         (if apr_vfdate=? then " 000" else "V000")
>         accountno
>         string(apr_check,"9999999999")
>         string(apr_amount * 100, "9999999999")
>         "         "
>         string(apr_cdate,"999999")
>         string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
>         "                  "
>         CHR(13) CHR(10).
> end.
> OUTPUT STREAM s1 CLOSE.

 
 
 

put unformatted to file in SCO Unix and Unixware

Post by Meneghell » Sun, 10 Oct 1999 04:00:00


Hello,

Maybe theres a control character (which code is bellow 32) in avm_name.
To clean this variable from any control character, use this code:

define variable i-counter as integer no-undo.
do i-counter = 1 to 31:
   do while index(avm_name, chr(i-counter)) > 0:
      assign substring(avm_name, index(avm_name, chr(i-counter)), 1) = " ".
   end.
end.

This code will be faster if you diminish the set of control characters you are
looking for.

I have never used chr(13) chr(10) to finish a line. Try using skip instead.
The put statement would be like this:

     PUT STREAM s1 UNFORMATTED
        (if apr_vfdate=? then " 000" else "V000")
        accountno
        string(apr_check,"9999999999")
        string(apr_amount * 100, "9999999999")
        "         "
        string(apr_cdate,"999999")
        string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
        "                  "
        skip.

Best regards.

Paulo Meneghelli Jr

--------------------------------------------


> short version of program  (does the samething)

> define stream s1.
> OUTPUT STREAM s1 to mikevoid.txt.
> DEFINE VARIABLE accountno as CHARACTER NO-UNDO.
>     for each ap_recon  where apr_cdate >= 9/1/1999,
>     each ap_bank   where abm_num    = apr_bank NO-LOCK,
>     each ap_vendor where avm_num    = apr_vendor NO-LOCK:

>     accountno =SUBSTR(abm_account,1,2) + SUBSTR(abm_account,4,3) +
> SUBSTR(abm_account,8,3).

> /*    display accountno apr_check apr_amount apr_cdate avm_name.
> */
>      PUT STREAM s1 UNFORMATTED
>         (if apr_vfdate=? then " 000" else "V000")
>         accountno
>         string(apr_check,"9999999999")
>         string(apr_amount * 100, "9999999999")
>         "         "
>         string(apr_cdate,"999999")
>         string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
>         "                  "
>         CHR(13) CHR(10).
> end.
> OUTPUT STREAM s1 CLOSE.

 
 
 

put unformatted to file in SCO Unix and Unixware

Post by Meneghell » Sun, 10 Oct 1999 04:00:00


Hello,

Maybe theres a control character (which code is bellow 32) in avm_name.
To clean this variable from any control character, use this code:

define variable i-counter as integer no-undo.
do i-counter = 1 to 31:
   do while index(avm_name, chr(i-counter)) > 0:
      assign substring(avm_name, index(avm_name, chr(i-counter)), 1) = "
".
   end.
end.

This code will be faster if you diminish the set of control characters
you are
looking for.

I have never used chr(13) chr(10) to finish a line. Try using skip
instead.
The put statement would be like this:

     PUT STREAM s1 UNFORMATTED
        (if apr_vfdate=? then " 000" else "V000")
        accountno
        string(apr_check,"9999999999")
        string(apr_amount * 100, "9999999999")
        "         "
        string(apr_cdate,"999999")
        string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
        "                  "
        skip.

Best regards.

Paulo Meneghelli Jr

--------------------------------------------


> short version of program  (does the samething)

> define stream s1.
> OUTPUT STREAM s1 to mikevoid.txt.
> DEFINE VARIABLE accountno as CHARACTER NO-UNDO.
>     for each ap_recon  where apr_cdate >= 9/1/1999,
>     each ap_bank   where abm_num    = apr_bank NO-LOCK,
>     each ap_vendor where avm_num    = apr_vendor NO-LOCK:

>     accountno =SUBSTR(abm_account,1,2) + SUBSTR(abm_account,4,3) +
> SUBSTR(abm_account,8,3).

> /*    display accountno apr_check apr_amount apr_cdate avm_name.
> */
>      PUT STREAM s1 UNFORMATTED
>         (if apr_vfdate=? then " 000" else "V000")
>         accountno
>         string(apr_check,"9999999999")
>         string(apr_amount * 100, "9999999999")
>         "         "
>         string(apr_cdate,"999999")
>         string(substr(avm_name,1,15),"XXXXXXXXXXXXXXX")
>         "                  "
>         CHR(13) CHR(10).
> end.
> OUTPUT STREAM s1 CLOSE.

 
 
 

put unformatted to file in SCO Unix and Unixware

Post by Niels Diepevee » Wed, 13 Oct 1999 04:00:00


Michael Lockwood schreef:

Quote:

> PUT UNFORMATTED

...

>     CHR(13) CHR(10).

I think the problem might be using the CHR(13) CHR(10) instead of SKIP
(or CHR(13) SKIP if you are on Unix). If you do this, you probably
exceed the maximum line length. If for some reason you can't use SKIP,
you may have to use PUT CONTROL. (for everything, not just the control
characters)

--
Niels Diepeveen
Endea automatisering