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
 

 

Problem with VARCAHR when unloading and sorting

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Mon Jun 25, 2007 3:57 pm    Post subject: Problem with VARCAHR when unloading and sorting
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    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Mon Jun 25, 2007 4:42 pm    Post subject:
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    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Mon Jun 25, 2007 4:47 pm    Post subject:
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: 120
Location: USA

PostPosted: Tue Jun 26, 2007 9:24 am    Post subject: Re: Problem with VARCAHR when unloading and sorting
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm


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