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

convert FB record structure with VARCHAR to VB file.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Oct 08, 2012 9:05 pm
Reply with quote

Hi,

We have a FB file with a length 21167 and would like to convert it to a VB file to save DASD space. Below given is the record structure:

Code:

FIELD-1        CHAR(3)  PRIMARY KEY
FIELD-2        CHAR(10) PRIMARY KEY
FIELD_DESC     CHAR(35)           
FIELD_NBR      CHAR(8)             
FIELD_TYPE     CHAR(25)           
FIELD_TS       TIMESTAMP           
FIELD_CHKSUM   CHAR(32)           
FIELD_STATE    VARCHAR(21000)     
FIELD_ID       CHAR(10)           
FIELD_DATE     DATE               
FIELD_FLAG     CHAR(1)             


The field "FIELD_STATE" hardly has data of maximum of 1900 characters only and minimum of 600 characters and does not exceed that. Can you please help me to convert this file from FB to VB. Is it possible? I don't know how to convert this because this field is lying in between other columns.

Please help.

Thanks.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Mon Oct 08, 2012 9:36 pm
Reply with quote

Hi Ramsri,

How is this FB data set created? Unload of DB2 table?
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Oct 08, 2012 9:42 pm
Reply with quote

Hi,

Output FB dataset is created through program.

Thanks.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Mon Oct 08, 2012 9:51 pm
Reply with quote

So presumably this program moves the VARCHAR column to a fixed-length character field and writes a fixed-length record. Have you considered changing the program to use variable-length fields and records?
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Mon Oct 08, 2012 10:04 pm
Reply with quote

Is it possible to change the program to create VB data set instead of FB one?

In General,

Code:
FD vb-file
RECORDING MODE V
RECORD IS VARYING IN SIZE FROM 1 TO max_value CHARACTERS
DEPENDING ON ws-var-length
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
01 vb-record  PIC X(max_value).


For every WRITE, move the desired data to vb-record as well as the desired length to ws-var-length and all will be OK.

In your case, while WRITE/READing ( if this VB data set is used as input), you'll need to have many record layouts for VB data set based on the record value and length. Perhaps, an indicator to identify the record type (record length) may be added at the starting of each record.

Please review.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Mon Oct 08, 2012 10:43 pm
Reply with quote

Whilst you are going about all this rearrange your structure so that the varchar field is the last field. You will have to recompile any program that uses that copybook (which you would have to do anyway as you are changing from FB to VB)

I assume you are wanting a SYNCSORT solution for this requirement otherwise you would have posted in one of the language sections or the DFSort section.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Oct 09, 2012 8:17 am
Reply with quote

Hi, Program can't be touched (external system). We get the file and want to save DASD space on our side. Yes.....we use Syncsort and looking to convert it from FB to VB.

Thanks.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Oct 09, 2012 2:20 pm
Reply with quote

Hi,

like Nic says, you will need to change all programs that currently read the FB file after converting the file to VB, a lot of work just to save some space.


Gerry
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Oct 09, 2012 5:08 pm
Reply with quote

Saving 19k per record is probably noticeable. It'd allow you to get more than two records per track :-)

Ramsri,

Note Nic's point about the fields after your VARCHAR. They need to be relocated.

What is your VARCHAR "padded" with? Does it actually contain the length in the first two bytes?
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Oct 09, 2012 5:50 pm
Reply with quote

Bill, this is not a program from our system......we don't own it. we just get the file and create a backup. We find that its occupying too much of space even though it does not utilize all VARCHAR(21000) but hardly 1900 or 2000 of it.

Thanks.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Oct 09, 2012 6:07 pm
Reply with quote

Err... I know all that.

If you want to make the record variable you have the easy way, which is to relocate you variable-length part to the "end" of the record. Or the difficult way, which is to plonk the variable-length part somewhere in the "middle" of the record and jump through hoops to find all the fields later.

You explained you can't change the program, and I've not suggested you need to. It is simple. At the same time as you make the record variable, you move the necessary fields.

FTOV, VLTRIM with whatever it is that you are keeping to yourself that is padding the VARCHAR.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue Oct 09, 2012 6:15 pm
Reply with quote

You can use Syncsort to rearrange the fields and backup the data.

You can change to VB at that time.

Use Sycnsort to restore the data back to original format when/if needed.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Oct 09, 2012 6:18 pm
Reply with quote

The VARCHAR (21000) content from file shows its length in binary format in output file........does it help anyway to create a VB from FB file. We can't rearrange the fields to move varchar to end of file.

Thanks.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue Oct 09, 2012 6:23 pm
Reply with quote

Quote:
We can't rearrange the fields to move varchar to end of file


If this is a true statement then your are SOL (system out of luck).

So sorry.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Oct 09, 2012 6:29 pm
Reply with quote

Code:
FIELD-1        CHAR(3)  PRIMARY KEY
FIELD-2        CHAR(10) PRIMARY KEY
FIELD_DESC     CHAR(35)           
FIELD_NBR      CHAR(8)             
FIELD_TYPE     CHAR(25)           
FIELD_TS       TIMESTAMP           
FIELD_CHKSUM   CHAR(32)           
FIELD_ID       CHAR(10)           
FIELD_DATE     DATE               
FIELD_FLAG     CHAR(1)
FIELD_STATE    VARCHAR(21000)     


Ramsri,

I managed it.

If you can't do that tell us why not?

Then, with your secret trailing character and VLTRIM you can get variable-length records. If you want to go for fixed-length-but-shorter you can do that, but note that the fields following the VARCHAR will change their position.

Sit back and read through the whole topic.

Then tell us what you are not allowed to do, and why, and then rather than knocking-back suggestions which have not been made, one by one, we can get a grip on the whole thing?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Tue Oct 09, 2012 6:30 pm
Reply with quote

if You simply want to create a backup
use DFDSS, it has quite a good compression factor!
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Oct 09, 2012 6:50 pm
Reply with quote

Bill, no....I am not knocking back the suggestions icon_eek.gif I thought the rearrangement might confuse the appl. programmer when one wants to bring the data from backup and use it as input somewhere. I think some kind of notes in backup JCL should be written. icon_surprised.gif

Is this solution work on big/large files? The file always contains records anywhere between 300,000 to 450,000.

Please suggest the solution you offered.

Thanks.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Tue Oct 09, 2012 6:52 pm
Reply with quote

Quote:
Please suggest the solution you offered.


who are You asking ???
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Oct 09, 2012 7:03 pm
Reply with quote

Sorry Ramsri, I missed the "I just want to create a backup" whilst I was being "all-knowing" :-)

Leave the file alone. Look at what enrico posted. If you change the file, it mightn't count as much of a backup, and would only save a couple of extra bytes over enrico's suggestion.

Edit: And even those couple of bytes might be "lost" to other compression possibilities in the record. Why didn't you say up front you just wanted a backup?
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Oct 09, 2012 7:24 pm
Reply with quote

Enrico, I see few of our jobs use PGM=ADRDSSU but write to UNIT=TAPE. Can I write to a tape instead of DASD? Does writing to tape saves space too?

Thanks.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Oct 09, 2012 7:28 pm
Reply with quote

If some jobs at your site are using UNIT=TAPE then there may be nothing to stop you also doing that. It is a good medium for backup. Saves a lot of DASD. Why don't you talk to your Production Control/Storage Management people and explain what you have, and then you'll get to do it the way they want you to do it, which is something we can't possibly know.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Oct 09, 2012 7:41 pm
Reply with quote

Hello,

Quote:
Can I write to a tape instead of DASD?
You need to talk with your storage management people. Different organizations have different rules about which media is acceptable for different usage.

Several places i support have decided to create these "one off" backups on dasd and allow them to migrate quickly to be recalled if/when needed.

Others have gone to "virtual tape" which acts like tape/cart and is managed by the Tape Management software but is actually dasd. Again, your storage management people will know how to meet your requirement following "the rules".

If the programmers are to be able to restore and use this data, you will need a companion process to make the backed up data available. For example if you use adrdssu for the backup, they cannot use sort for the restore.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts how to complete the end of a record w... DFSORT/ICETOOL 2
Search our Forums:

Back to Top