View previous topic :: View next topic
|
Author |
Message |
KMV
New User
Joined: 15 May 2007 Posts: 22 Location: Coimbatore
|
|
|
|
Hi,
I have two types of record (with diff layouts) in a file.
lets consider
A : name phoneno address
B : address name phoneno
now i have to include a comma between the fields (i.e)
my output should be some thing like this
A : name ,phoneno ,address
B : address ,name ,phoneno |
|
Back to top |
|
|
chiranjeevi_mca
New User
Joined: 19 Feb 2006 Posts: 27
|
|
|
|
Hi,
Using String we can concatinate all the data-items and keywords
STRING NAME DELIMITED BY SIZE (or ' ')
',' DELIMITED BY SIZE
PHONENO DELIMITED BY SIZE
',' DELIMITED BY SIZE
ADDRESS DELIMITED BY SIZE
INTO VARIABLE
END-STRING.
try this, this will help you.
Chiranjeevi |
|
Back to top |
|
|
Vinit Bhushan
New User
Joined: 17 Apr 2007 Posts: 4 Location: Gurgaon
|
|
|
|
Hi,
You can also use this method.
To define the Extract along with the comma field.
Example
**********EXTRACT FILE LAYOUT START HERE*********
01 DTL-OUT-ICMPNMTC.
05 DTL-SSN PIC 9(09) VALUE ZEROES.
05 FILLER PIC X(01) VALUE ','.
05 DTL-NM-LIN-1 PIC X(30) VALUE SPACES.
05 FILLER PIC X(01) VALUE ','.
05 DTL-NXT-PMT-DAT PIC 9(08) VALUE ZEROES.
05 FILLER PIC X(01) VALUE ','.
05 DTL-CUR-LN-BAL PIC 9(09).99 VALUE ZEROES.
************************************************** |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Do you want the "whole" field copied to the output or only the meaningful characters?
Let's say name is 35 bytes long. Let's also say that the value is "SMITH, JOHN A.". What should the output look like?
Are commas permissable in the data fields or should embedded commas be removed?
Is this an interview question, school exercise, or an actual programming requirement? If this is a real requirement, you need to post more info on the rules for your input and output. |
|
Back to top |
|
|
KMV
New User
Joined: 15 May 2007 Posts: 22 Location: Coimbatore
|
|
|
|
Thank u for all ur replies.
This is for real requirement and whole field has to be copied to the output (including the trailing spaces).
Comma must be a seperate character apart from the field.
Quote: |
Let's say name is 35 bytes long. Let's also say that the value is "SMITH, JOHN A.". What should the output look like? |
for this the comma should come at 36th position. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I believe if that is the complete requirement, you could either use STRING or you could define a new area that was field-name1, comma-literal, field-name2, etc, as were suggested.
They should both yield the same result. |
|
Back to top |
|
|
|