× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Tony,
I based my code on that sample.
The code I use to create the file is:

D IFS_File_Name S 256A

D fd S 10I 0

D Open_Flag S 10I 0

D Mode_Flag S 10U 0

D Code_Page S 10U 0 Inz(819)

// Remove file if it exists first, so we don't overwrite beg file seg

RC=unlink(%TrimR(IFS_File_Name));

// Create file with correct code page, in text mode

Open_Flag = O_CREAT + O_WRONLY + O_CODEPAGE;

Mode_Flag = S_IWUSR + S_IRUSR + S_IRGRP + S_IROTH;

fd=open(%TrimR(IFS_File_Name) :Open_Flag : Mode_Flag : Code_Page);

// Close file

RC=close(fd);

// File Created - Open for text output

Open_Flag = (O_WRONLY + O_TEXTDATA + O_APPEND);

fd=open(%TrimR(IFS_File_Name) : Open_Flag);


Tony Carolla <carolla@xxxxxxxxx> wrote:
On 7/14/05, Jeffrey Young wrote:
> 
> That is what I am trying to do.
> I am creating the file directly on the IFS, and getting corrupted data in 
> the output, and unable to open the file in EXCL unless I first OPEN & SAVE 
> using NOTEPAD.
> All suggestions are welcome.



Here is a subproc I used to output to excel:

P Excelify B
D Excelify PR
D Excelify PI

// Standalones
D fd S 10I 0 Inz
D RC S 10I 0 Inz
D UserName S 10A Inz(*User)
D Today S D Inz(*Sys)
D FileName S 43A Varying
D OpenName S 200A Varying
D EndOfSheet S 22A Inz('')

// Constants
D Tb1 C ''
D Tb2 C ''
D FilePrefix C '/home/mcare_appeals_Extracts/'
D FileSuffix C '.XLS'
D StartPCO C 'STRPCO'
D OpenPrefix C 'STRPCCMD PCCMD(''\\10.10.4.15\root\-
D home\mcare_appeals_extracts\'
D OpenSuffix C '.xls'') PAUSE(*NO)'

// Structures
D Title1 DS Qualified
D Chunk1 221A Inz('D style="text-align:center;">MedAmeri-
D ca Billing Services, Inc. -- Medicar-
D e Appeals Extract Listing-
D ')

D Title2 DS Qualified
D Chunk1 368A Inz('
D align="center" border="1" style="wid-
D th:800px;" title="Detail">D "center" bgcolor="blue" style="color-
D :white;font-weight:bold;">SiteD th>Account#Patient_Name-
D Bill_IDIns#D h>1st_ExtractCodeL-
D ast_ExtractCodeUse-
D rPmts_AfterPmts_To-
D tal')

D DSTitle DS Qualified
D Chunk1 12A Inz('Result Code ')
D RCChoice 3A Inz
D Chunk2 4A Inz(' -- ')
D EarlyDate 10A Inz

D DSDetail DS Qualified
D Chunk1 67A Inz('')
D Site 3A Inz
D Chunk2 9A Inz(Tb1)
D Account 15A Inz
D Chunk3 27A Inz(Tb2)
D Patname 20A Inz
D Chunk4 9A Inz(Tb1)
D BillId 2A Inz
D Chunk5 27A Inz(Tb2)
D Insur 5A Inz
D Chunk6 9A Inz(Tb1)
D FirstXDate 10A Inz
D Chunk7 27A Inz(Tb2)
D FirstXCode 3A Inz
D Chunk8 9A Inz(Tb1)
D LastXDate 10A Inz
D Chunk9 27A Inz(Tb2)
D LastXCode 3A Inz
D Chunk10 9A Inz(Tb1)
D UserName 10A Inz
D Chunk11 27A Inz(Tb2)
D PmtsAfter 10A Inz
D Chunk12 9A Inz(Tb1)
D PmtTot 10A Inz
D Chunk13 10A Inz('')

/Free
FileName=FilePrefix+%Trim(UserName)+FileSuffix;

// Remove file if it exists first, so we don't overwrite beg file seg
RC=unlink(FileName);

// Create file with correct code page, in text mode
fd=open(Filename:O_CREAT+O_WRONLY+O_CODEPAGE:
S_IWUSR+S_IRUSR+S_IRGRP+S_IROTH:819);
RC=close(fd);
fd=open(FileName:O_WRONLY+O_TEXTDATA);

// Write header
RC=write(fd:%addr(Title1):%Size(Title1));

DSTitle.RCChoice=DFRes;
DSTitle.EarlyDate=%Char(Today:*usa);
RC=write(fd:%addr(DSTitle):%Size(DSTitle));

RC=write(fd:%addr(Title2):%Size(Title2));

// Write detail lines
If %Open(MCareTmp);
Close MCareTmp;
EndIf;
Open MCareTmp;

Read Mctmp Mti;
Dow Not %EOF(MCareTmp);
DSDetail.Site=Mti.Tmsite;

// Prevent Excel from recognizing account numbers as dates
DSDetail.Account='="' + Mti.Tmacct + '"';

DSDetail.Patname=Mti.TMPatName;
DSDetail.BillId=Mti.TMBillId;
DSDetail.Insur=Mti.Tmins;
DSDetail.FirstXDate=Mti.Tmx1d;
DSDetail.FirstXCode=Mti.TMX1c;
DSDetail.LastXDate=Mti.Tmxld;
DSDetail.LastXCode=Mti.Tmxlc;
DSDetail.UserName=Mti.TMUser;
DSDetail.PmtsAfter=Mti.Tmaft;
DSDetail.PmtTot=Mti.Tmtot;

RC=write(fd:%addr(DSDetail):%Size(DSDetail));

Read MCTmp Mti;
EndDo;

RC=write(fd:%addr(EndOfSheet):%size(EndOfSheet));
RC=close(fd);

OpenName=OpenPrefix+%Trim(UserName)+OpenSuffix;
RC=system(StartPCO);
RC=system(OpenName);

Return;
/End-Free
P Excelify E

Hope this helps...




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.