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

Problem with VARCAHR when unloading and sorting


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

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Mon Jun 25, 2007 3:57 pm
Reply with quote

Hi,

In my table i had a field of type VARCHAR of length 78. When i do the unload the output file it is creating as VB format.
Say the file name as UNLOAD.TABLE.VBFMT

Now i am using this table as my input and sorting. The output file is FB format.
The job is as follows:
//SORTJOB JOB 1,CLASS=6,MSGCLASS=0,NOTIFY=&SYSUID
//STEP010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=C
//SYSPRINT DD SYSOUT=*
//*INPUT FILE
//INPUT DD DSN=UNLOAD.TABLE.VBFMT,DISP=SHR
//*OUTPUT FILE
//OUTPUT DD DSN=OUTPUT.FILE.AFTER.SORT,
// DISP=(,CATLG,DELETE),SPACE=(CYL,(500,500),RLSE),
// RECFM=FB,LRECL=569
//TOOLIN DD *
COPY FROM(INPUT) TO(OUTPUT) USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(5,7,PD,A,44,3,CH,A)
OUTFIL FNAMES=OUDMCSTA,REMOVECC, VTOF,
OUTREC=(1:5,569)
/*

When i run this the output file is creating. But the data alignment is not proper.
This is because even though my varchar is of 78 length i am giving data of 10 characters. So the rest of 68 is filled by the data next to it. But it should be spaces. So the data alignment is not proper. If i give the value for the entire varchar field then i am getting proper output. If it is less than 78 the later part of data is moved to this varchar field.
What should i do in this regard.

Regards,
Bhaskar.
Back to top
View user's profile Send private message
ibmmainframesyntel

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Mon Jun 25, 2007 4:38 pm
Reply with quote

check the data in UNLOAD.TABLE.VBFMT weather is it correct or not?
if the input file data is correct ,the o/p will be same.

so first check the input file
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Mon Jun 25, 2007 4:42 pm
Reply with quote

Bhaskar,

Declare the variable as CHAR and not as VARCHAR..
Back to top
View user's profile Send private message
ibmmainframesyntel

Active User


Joined: 26 Feb 2007
Posts: 126
Location: Chennai

PostPosted: Mon Jun 25, 2007 4:45 pm
Reply with quote

i think,this is the post which related to ur previous post.
If yes,why u posted this as a NEW post?
getting confuse.u hav to give a reply for that,not new post.

If it is same post,
then I/P file LRECL=569,VB ,am i corrct?

If yes change the O/p file LRECL=465.
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Mon Jun 25, 2007 4:47 pm
Reply with quote

Sorry about my previous post.

Quote:
This is because even though my varchar is of 78 length i am giving data of 10 characters


Since your variable is varchar variable, you are getting overlap. If you are data lenght in the var is always 10, change the sort card such that 68 spaces are padded.
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Tue Jun 26, 2007 9:24 am
Reply with quote

Hi,

For the above Query the probelm got resolved.
While i am unloading from the table i had to code like this

UNLOAD
FORMAT DSNTIAUL
DIRECT AUTO

SELECT
xxx
,yyy
,zzz
from table-name;

So if code FORMAT DSNTIAUL while unloading, it will convert the varchar filed to char and generates my output file as FB. Now my data is matching with copybook.

Thanks to all......

Regards,
Bhaskar.
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 Map Vols and Problem Dataset All Other Mainframe Topics 2
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
Search our Forums:

Back to Top