View previous topic :: View next topic
|
Author |
Message |
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
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 |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Hi Ramsri,
How is this FB data set created? Unload of DB2 table? |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
Output FB dataset is created through program.
Thanks. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
if You simply want to create a backup
use DFDSS, it has quite a good compression factor! |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Bill, no....I am not knocking back the suggestions 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.
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
Please suggest the solution you offered. |
who are You asking ??? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|