Computing.Net > Forums > Unix > creating data file with new line

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

creating data file with new line

Reply to Message Icon

Original Message
Name: Dani1959
Date: May 8, 2007 at 01:22:28 Pacific
Subject: creating data file with new line
OS: UNIX
CPU/Ram: ---
Manufacturer/Model: ---
Comment:

I use the following code in ksh to create data file that will be transfered by FTP to mainframe:
sqlplus -s x/xxx@xxxxx << END 2> $global_path/log/PrHilanActivities.err
SPOOL /n/ttpafn01/vol/vol1/unix-apps/production/EAI/entirex/fileout/hilan/TLRACT.KLT
SET HEADING OFF FEED ON PAGESIZE 0 space 0 LINESIZE 87
select '122', '0303',
CASE SUBSTR(a.activity_status,1,1) WHEN 'C' THEN '2' ELSE ' ' END upd,
'804',
LPAD(SUBSTR(a.activity_id,2,9),9,'0') a_id, 'p',
LPAD(REVERSE(LOWER(SUBSTR(a.activity_desc,1,29))),29,' ') desc1, ' ' bl,
LPAD(SUBSTR(b.baan_project_id,2,12), 12, '0') proj ,
CASE SUBSTR(b.baan_project_id,1,1) WHEN 'I' THEN '02' ELSE '01' END p_type,
'2',
NVL(SUBSTR(to_char(NVL(a.activity_open_date,b.created_date), 'DDMMYY' ),1,6), '010101') o_date,
NVL(SUBSTR(to_char(a.activity_closed_date, 'DDMMYY' ),1,6), '999999') cl_date
from ats_activity a ,ats_project b
where a.ats_project_id=b.ats_project_id
AND SUBSTR(a.activity_id,1,1) = 'P'
AND a.activity_closed_date is null
AND SUBSTR(a.activity_status,1,1) <> 'C'
AND ( ( SUBSTR(b.baan_project_id,3,4) >= '2000' AND SUBSTR(b.baan_project_id,3,4) <= '3699' )
OR ( SUBSTR(b.baan_project_id,3,4) >= '1104' AND SUBSTR(b.baan_project_id,3,4) <= '1699' ) )
AND (a.activity_open_date > sysdate-10 OR a.activity_closed_date > sysdate-10);
spool off
END
) >> $LOG
It looks OK in UNIX, but when the file arrives to mainframe it looks like one line. What shoud I do to solve the problem.
Thanks a lot.


Best regards
Dani.


Report Offensive Message For Removal


Response Number 1
Name: sboffin
Date: May 8, 2007 at 11:19:31 Pacific
Reply: (edit)

Try to do a unix2dos before sending the file


Report Offensive Follow Up For Removal

Response Number 2
Name: Dani1959
Date: May 10, 2007 at 00:08:50 Pacific
Reply: (edit)

Hello,
Thanks a lot for your help and idea.
Actually I have solved the problem by adding at the endof select statement CHR(13) and then I used grep command to filter all needed lines .
My be your idea is more better - I'll test too.
Thanks a lot, once again.
Dani.

Best regards
Dani.


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software