View previous topic :: View next topic
|
Author |
Message |
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Hi,
Input File layout
Code: |
01 :PFX:-RECORD.
03 :PFX:-LICENCE-NUMBER PIC X(08).
03 :PFX:-LICENSEE-NAME-LEN PIC 9(03) COMP-3.
03 :PFX:-TRADING-NAME-CNT PIC 9(03) COMP-3.
03 :PFX:-LICENSEE-NAME.
05 :PFX:-LICENSEE-NAME-X PIC X(01) OCCURS 0 TO 120
DEPENDING ON
:PFX:-LICENSEE-NAME-LEN.
03 :PFX:-TRADING-NAME.
05 :PFX:-TRADING-NAME-X PIC X(100) OCCURS 0 TO 50
DEPENDING ON
:PFX:-TRADING-NAME-CNT.
|
Is it possible to convert the :PFX:-LICENSEE-NAME field to a fixed length of 120 by getting the length from :PFX:-LICENSEE-NAME-LEN using SYNCSORT and then append the TRADING-NAME |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
I am not sure what you are asking! Please supply sample input/output, RECFM, LRECL. |
|
Back to top |
|
|
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Hi,
My requirement is to migrate many such datasets mapped to copybook structure (ODO) to fixed bytes layout.
For the above example, input will look like below:
lrecl = 5136
recfm = VB
Code: |
Field Picture Start Data
PFX-LICENCE-NUMBER X(08) 1 01234567
PFX-LICENSEE-NAME-LEN 9(03) 9 8
PFX-TRADING-NAME-CNT 9(03) 11 1
PFX-LICENSEE-NAME 13 ABC. PVT
PFX-TRADING-NAME 21 APPLE BANANA COMPANY
|
Code: |
Field Picture Start Data
PFX-LICENCE-NUMBER X(08) 1 02345678
PFX-LICENSEE-NAME-LEN 9(03) 9 10
PFX-TRADING-NAME-CNT 9(03) 11 2
PFX-LICENSEE-NAME 13 DEFGH LTD.
PFX-TRADING-NAME 23 D. ASSOCIATES
|
Here, we need to move ABC. PVT/DEFGH LTD to a fixed length field of X(120) and then start the TRADING NAME from 13 + 120 = 134 th position for all the records.
Hence I am trying to find out a way where we know the starting position of LICENSEE-NAME (in first case it is 21 while in the second case it is 23)
Thanks
TS70363 |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Was that a typo?...Looks like the starting position of TRADING-NAME is the one which is varying. You could write a bit of code to achieve this. |
|
Back to top |
|
|
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Hi,
I have many such files with different layouts and hence looking for an approach thru Sort |
|
Back to top |
|
|
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Can this be achieved with sort? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes, I think so.,
You'd be looking at around 22 IFTHENs (minimum) but they'd all be doing the same thing.
Do you have a couple of other examples of your files? |
|
Back to top |
|
|
|