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

Need to convert the 7 character field to 11 character field


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Tue Aug 07, 2007 11:43 am
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
Search our Forums:

Back to Top