Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to convert the 7 character field to 11 character field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
kksbabu05

New User


Joined: 03 May 2007
Posts: 3
Location: chennai

PostPosted: Tue Aug 07, 2007 11:39 am    Post subject: Need to convert the 7 character field to 11 character field
Reply with quote

There is a file, which has a account number field of 7 characters, need to convert the 7 character field to 11 character field by padding zeroes in the front and write to a new file using cobol program.
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Aug 07, 2007 11:43 am    Post subject:
Reply with quote

kksbabu05,

Plese post the variable declarations.
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Tue Aug 07, 2007 2:18 pm    Post subject: Re: Need to convert the 7 character field to 11 character fi
Reply with quote

Does your file look something like this?
Code:

01  INFILE.                   
    02 IN-1  PIC X(10).       
    02 IN-ACC  PIC X(7).       
    02 IN-2  PIC X(33).       


and do you want it to look something like this?

Code:

01  OUTFILE.                           
    02 OUT-1 PIC X(10).                 
    02 NEW-ACC.                         
       03 FILLER PIC X(4) VALUE ZEROS. 
       03 OUT-ACC  PIC X(7).           
    02 OUT-2  PIC X(33).                             


or something else?

or do you need to pad the original 7 char field with zeros as well
e.g. is it already held as
Code:

'0000123'

or
Code:

'    123'


please give examples.
Back to top
View user's profile Send private message
kksbabu05

New User


Joined: 03 May 2007
Posts: 3
Location: chennai

PostPosted: Wed Aug 08, 2007 12:55 pm    Post subject: Re: Need to convert the 7 character field to 11 character fi
Reply with quote

IQofaGerbil wrote:
Does your file look something like this?
Code:

01  INFILE.                   
    02 IN-1  PIC X(10).       
    02 IN-ACC  PIC X(7).       
    02 IN-2  PIC X(33).       


and do you want it to look something like this?

Code:

01  OUTFILE.                           
    02 OUT-1 PIC X(10).                 
    02 NEW-ACC.                         
       03 FILLER PIC X(4) VALUE ZEROS. 
       03 OUT-ACC  PIC X(7).           
    02 OUT-2  PIC X(33).                             


or something else?

or do you need to pad the original 7 char field with zeros as well
e.g. is it already held as
Code:

'0000123'

or
Code:

'    123'


please give examples.


Hi IQofaGerbil,

Whatever file layout you have mentioned is same

The program should be a subroutine
The subroutine is called using below Linkage variables

Old Static File Layout
New Static File Layout
File Processing Indicator
EOF Indicator

If the file processing indicator = Open, the static file is opened and the control is returned back to the main program
If the File processing indicator = Read, next record in the file is read and the account number field is converted from length of 7 to 11 and the values of the record are moved to the new record layout and the data is passed back to the main program
If the EOF is reached the EOF Indicator is set to true such that the main program will stop calling the adapter to read further record
Back to top
View user's profile Send private message
kksbabu05

New User


Joined: 03 May 2007
Posts: 3
Location: chennai

PostPosted: Wed Aug 08, 2007 12:58 pm    Post subject:
Reply with quote

Hi IQofaGerbil,

Whatever file layout you have mentioned is same

The program should be a subroutine
The subroutine is called using below Linkage variables

Old Static File Layout
New Static File Layout
File Processing Indicator
EOF Indicator

If the file processing indicator = Open, the static file is opened and the control is returned back to the main program
If the File processing indicator = Read, next record in the file is read and the account number field is converted from length of 7 to 11 and the values of the record are moved to the new record layout and the data is passed back to the main program
If the EOF is reached the EOF Indicator is set to true such that the main program will stop calling the adapter to read further record


Please let me know the code
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Wed Aug 08, 2007 3:21 pm    Post subject: Re: Need to convert the 7 character field to 11 character fi
Reply with quote

Quote:

If the file processing indicator = Open, the static file is opened and the control is returned back to the main program
If the File processing indicator = Read, next record in the file is read and the account number field is converted from length of 7 to 11 and the values of the record are moved to the new record layout and the data is passed back to the main program
If the EOF is reached the EOF Indicator is set to true such that the main program will stop calling the adapter to read further record


...errrmmm I think that you have practically all but coded it yourself have you not?

Just ad a few IFs and ELSEs thow in a MOVE an OPEN maybe a READ and a GOBACK
place them all strategically in your spec and you are away!

Unless of course that this is your first Cobol program - ever?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us