View previous topic :: View next topic
|
Author |
Message |
maddepusrikanth
New User
Joined: 29 Jul 2008 Posts: 4 Location: Bangalore ,INDIA
|
|
|
|
I want to read a comma-delimited file of length X(180) & write in into mainframs PS files ,so the Ps file will be input for other job .
Note :
1)the output PS file should consist of Header record &Trailer records
Trailer-ID, Number of records,total - debit amount, Total-credit amount for Trailer records.
2) in the O/PPS file there is a input
if a record is having 1100 in the file it should write as 183140 & soon
183140 comes from other input files .
thanks
Srikanth |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
It is possible to read a CSV file and reformat it to a fixed format file. It just takes a lot of scanning of the input file to find the field separators and moving an reformatting of the data to the desired format. I have done it many times. You just have to look at the input file and the desired output and work from there. NO I will not provide you with the code, my employer pays me for this work and doesn't like me giving it away. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
So where are you stuck up and what does this mean:
Quote: |
in the O/PPS file there is a input
if a record is having 1100 in the file it should write as 183140 & soon
183140 comes from other input files . |
Show some example of input/output please. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
i would utilize the UNSTRING instruction to identify each field, then as Craig said, work from there. |
|
Back to top |
|
|
maddepusrikanth
New User
Joined: 29 Jul 2008 Posts: 4 Location: Bangalore ,INDIA
|
|
|
|
Hi,
i am looking for the code in COBOL for my release work. |
|
Back to top |
|
|
Suresh Ponnusamy
Active User
Joined: 22 Feb 2008 Posts: 107 Location: New York
|
|
|
|
You can use either of the below method
1)
In a PERFORM UNTIL loop read the File record, you can read character by character from the File record and move the value to an array until you encounter a ',' , then move the array value to a variable.
or
2) As Dick mentioned, in PERFORM UNTIL LOOP read the File Record, use UNSTRING function on the File Record using ',' as a delimiter.
If you definitely know the size of the which holds the value of each comma separated then UNSTRING function is more effective. Otherwise you can use the first one.
Suggestions are Welcome as always. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
i am looking for the code in COBOL for my release work. |
You need to create some code and post back here when you have questons or problems. Someone will be able to help.
I'd suggest you try UNSTRING. If you are not familiar with UNSTRING, click on the "IBM Manuals" link at the top of the page and select the documentation for "your" version of COBOL. |
|
Back to top |
|
|
maddepusrikanth
New User
Joined: 29 Jul 2008 Posts: 4 Location: Bangalore ,INDIA
|
|
|
|
Hi ,
Please let me know any updates
Sri
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
there will not be any upates until You produce some code Yourself,
You got enough hints to start writing |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Please let me know any updates |
We are waiting for you to provide something for us to work with. . .
Quote: |
i am looking for the code in COBOL for my release work. |
When you provide what code you have written, someone should be able to answer any questions you have or explain why it does not work.
If you are not able to code everything yet, explain why not. If you clearly explain where there is confusion getting what you need to do, you will see that you have given yourself a start on the code. Describing a task usually helps with the solution. |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
>> i am looking for the code in COBOL for my release work.
Ok, i am looking forward to receive the purchase for that.
Then you will receive the pre-release code. |
|
Back to top |
|
|
maddepusrikanth
New User
Joined: 29 Jul 2008 Posts: 4 Location: Bangalore ,INDIA
|
|
|
|
Hi All,
At last i completed the codeing.it has moved to production now & working fine
thanks for your help
Thanks
SK |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
Nice to hear, hopefully we had been helpful..
- Ad |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi,
Good to see that your problem has sorted out.
i can think of one more solution if this program is running in batch.
if you know you can submit jcl from cobol program by coding
//ddname DD SYSOUT=(*,INTRDR)
in the jcl which is calling your cobol program.
on ddname you can write jcl statements
which calls iceman
where
sortin tells how you want to parse the file
something like
//SYSIN DD *
SORT FIELDS=COPY
INREC PARSE=(FLD0=(FIXLEN=4,ENDBEFR=DELI),
FLD1=(FIXLEN=5,ENDBEFR=DELI),
FLD2=(FIXLEN=30,ENDBEFR=DELI),
FLD3=(FIXLEN=2,ENDBEFR=DELI),
FLD4=(FIXLEN=30,ENDBEFR=DELI),
FLD5=(FIXLEN=10,ENDBEFR=DELI)),
BUILD=(FLD0,FLD1,JFY=(SHIFT=LEFT),FLD2,FLD3,FLD4)
/*
sortin and sortout will be input and output dsns
symnames will be symbolic names
something like
//SYMNAMES DD *
FLD0,%00
FLD1,%01
FLD2,%02
FLD3,%03
FLD4,%04
FLD5,%05
DELI,','
/* |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
also if you are calling this program only for parsing it then better option is to call iceman directly from jcl as prev step instead of doing it in cobol program it is more efficient. |
|
Back to top |
|
|
|