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

The length of varchar in unload file??


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Benjamin.L

New User


Joined: 11 Apr 2006
Posts: 17
Location: DL.PRC

PostPosted: Wed Aug 30, 2006 8:20 am
Reply with quote

Hi all,

the column in DB2 table is varchar(100) , when I unload it into a file, I want to know what is the length in file?

is there anyone can help me?
thanks a lot!
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Wed Aug 30, 2006 9:52 am
Reply with quote

Hi Benjamin,

If you're unloading using DSNTIAUL, give any record length and it will take what is required!

Or, if you're doing it through a COBOL program, you need to have 2 Bytes reserved for the length part of the VARCHAR field.

If the field is declared as FIELD_1 VARCHAR(100) NOT NULL, the COBOL representation will be
Code:
01 FIELD-1.
     10 FIELD-1-LEN     PIC S9(4) COMP.
     10 FIELD-1-TEXT   PIC X(100).

So, in brief, you need to have 102 bytes reserved for the VARCHAR field you mentioned, in the output file.

Cheers, Twissi.
Back to top
View user's profile Send private message
Benjamin.L

New User


Joined: 11 Apr 2006
Posts: 17
Location: DL.PRC

PostPosted: Wed Aug 30, 2006 10:37 am
Reply with quote

hi Cheers,

thanks for your helping, I think u r right.
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Wed Aug 30, 2006 1:01 pm
Reply with quote

Any time, Pal!
Back to top
View user's profile Send private message
soumyaranjan007

New User


Joined: 30 Aug 2006
Posts: 30
Location: mumbai

PostPosted: Sat Sep 02, 2006 4:47 pm
Reply with quote

Benjamin.L wrote:
Hi all,

the column in DB2 table is varchar(100) , when I unload it into a file, I want to know what is the length in file?

is there anyone can help me?
thanks a lot!



Hi,

the length of the file will be 100. In case of unload table try to use 'DSNUPROC' instead of 'ADUUMAIN' jcl utility.

DSNUPROC---- this jcl utility will take the varchar(100) as 100 length.
ADUUMAIN-----this jcl utility takes the system defined length.

Regards
Soumya Ranjan Pradhan
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top