IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to embed comma inbetween the fields of the record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
KMV

New User


Joined: 15 May 2007
Posts: 22
Location: Coimbatore

PostPosted: Tue Aug 21, 2007 4:12 pm
Reply with quote

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
View user's profile Send private message
chiranjeevi_mca

New User


Joined: 19 Feb 2006
Posts: 27

PostPosted: Tue Aug 21, 2007 4:23 pm
Reply with quote

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
View user's profile Send private message
Vinit Bhushan

New User


Joined: 17 Apr 2007
Posts: 4
Location: Gurgaon

PostPosted: Tue Aug 21, 2007 4:41 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Aug 22, 2007 3:32 am
Reply with quote

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
View user's profile Send private message
KMV

New User


Joined: 15 May 2007
Posts: 22
Location: Coimbatore

PostPosted: Wed Aug 22, 2007 6:48 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Aug 22, 2007 7:11 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top