Hi,
I am trying to read a flat file which has been formed from a csv file and populate a data area
eq,
csv file as below
abc,1.2,rr,,7.89,qqq
flat file is formed as
abc00001.2rr00007.8qqq
now i need above data to filled in data area
as fields like A(3),N(3.3),A(2),N(4.2),A(3)
is it possible anyway?
reading flat file and populating data area
-
- Posts: 4
- Joined: Sat Mar 10, 2012 1:09 pm
- Skillset: JCL, COBOL, DB2, VSAM, CICS
- Referer: MAINAK NAG
- RGZbrog
- Posts: 101
- Joined: Mon Nov 23, 2009 1:34 pm
- Skillset: Natural, Adabas, Predict, Natural Security, Construct, EntireX, SPoD, NaturalONE
- Referer: SAG Developer Forum
- Location: California, USA
- Contact:
Re: reading flat file and populating data area
For Natural under Windows or Unix it's a simple matter of reading the CSV directly. On the mainframe the CSV must be converted to a flat file, as you have done, but the format could be simplified to make your job much easier, because the record definition must match the data byte for byte.
If you changed the record format to abc001200rr000780qqq you would have the simplest solution.
In the data, note the implied decimal points and the number of digits before and after the decimal.
Because the record includes the decimal point and fewer decimal positions
You need to remove the decimal (MOVE EDITED) and then convert to the proper number of digits (MOVE/ASSIGN).
If you changed the record format to abc001200rr000780qqq you would have the simplest solution.
Code: Select all
DEFINE DATA LOCAL
1 #IN
2 #A1 (A3)
2 #N1 (N3.3)
2 #A2 (A2)
2 #N2 (N4.2)
2 #A3 (A3)
END-DEFINE
*
READ WORK 1 #IN
DISPLAY #A1 #N1 #A2 #N2 #A3
END-WORK
END
Because the record includes the decimal point and fewer decimal positions
Code: Select all
DEFINE DATA LOCAL
1 #IN
2 #A1 (A3)
2 #N1 (A7)
2 #A2 (A2)
2 #N2 (A7)
2 #A3 (A3)
1 #OUT
2 #N3 (N5.1)
2 #N4 (N5.1)
2 #N5 (N3.3)
2 #N6 (N4.2)
END-DEFINE
*
READ WORK 1 #IN
MOVE EDITED #N1 TO #N3 (EM=99999.9)
MOVE EDITED #N2 TO #N4 (EM=99999.9)
MOVE #N3 TO #N5
MOVE #N4 TO #N6
DISPLAY #A1 #N1 #N3 #N5 #A2 #N2 #N4 #N6 #A3
END-WORK
END
-
- Posts: 4
- Joined: Sat Mar 10, 2012 1:09 pm
- Skillset: JCL, COBOL, DB2, VSAM, CICS
- Referer: MAINAK NAG
Re: reading flat file and populating data area
Hi,
Thanks for the answer.
Infact thats what I also decided to do later on ........
Thanks for the answer.
Infact thats what I also decided to do later on ........
Re: reading flat file and populating data area
Text removed as it was copied from RGZbrog's reply, above.
We offer up to date pass4sure.co.uk exam practice questions with self paced test engine to help you pass UNC Greensboro exam and complete your ccent course & CISCO
-
- Global moderator
- Posts: 3006
- Joined: Fri Apr 18, 2008 11:25 pm
- Skillset: tso,rexx,assembler,pl/i,storage,mvs,os/390,z/os,
- Referer: www.ibmmainframes.com
Re: reading flat file and populating data area
On the mainframe the CSV must be converted to a flat file, as you have done, but the format could be simplified to make your job much easier, because the record definition must match the data byte for byte.
On the mainframe the CSV must be converted to a flat file, as you have done, but the format could be simplified to make your job much easier, because the record definition must match the data byte for byte.
any reason to clone a previous reply ???
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
-
- Similar Topics
- Replies
- Views
- Last post
-
-
EZIOE004 Logical I/O error on file occurred reading VB file
by savitha_y » Mon Feb 15, 2021 7:54 pm » in CA-Easytrieve - 3
- 4948
-
by savitha_y
View the latest post
Wed Feb 17, 2021 5:02 am
-
-
-
How to import a ZFS data file into VSAM catalog
by danik56 » Tue Nov 23, 2021 10:29 pm » in VSAM/SMS - 0
- 3398
-
by danik56
View the latest post
Tue Nov 23, 2021 10:29 pm
-
-
- 1
- 2483
-
by enrico-sorichetti
View the latest post
Fri Apr 02, 2021 6:56 pm
-
-
Code conversion issue while reading JCL using REXX
by vsgurunath » Fri Jun 19, 2020 10:19 pm » in CLIST & REXX - 11
- 4270
-
by vsgurunath
View the latest post
Thu Jun 25, 2020 4:08 pm
-
-
-
File Handling 3 input files and 1 output file by using EZT
by pavan426 » Thu Sep 09, 2021 12:17 am » in CA-Easytrieve - 0
- 4411
-
by pavan426
View the latest post
Thu Sep 09, 2021 12:17 am
-