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
 

 

Finding the Record Length

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Sandeep D. Patil

New User


Joined: 29 Jun 2008
Posts: 23
Location: mumbai

PostPosted: Wed Jun 24, 2009 4:35 pm    Post subject: Finding the Record Length
Reply with quote

Hi ,
I have a requirement that I have a file which have 2 field one containing the data and other containing the length of the data.

Structure of file
File 1
Col1 Col2
Abc 3
XYZW 2

Consider this is the kind of file so I need to check that weather we can check the length of the col1 data is equal to the col2 value.

For first case it true but for second one its not correct, so I need to change with the actual records length .

Can some one help me in doing this using a JCL?

Thanks in advance icon_biggrin.gif
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Jun 24, 2009 4:43 pm    Post subject:
Reply with quote

Quote:
Can some one help me in doing this using a JCL?

And which program would you like the JCL to execute.

Please remember that by itself JCL does nothing but to communicate to the processor which program is to be executed, which datasets are to be used for processing, and may also pass parameters to the program.
Back to top
View user's profile Send private message
Sandeep D. Patil

New User


Joined: 29 Jun 2008
Posts: 23
Location: mumbai

PostPosted: Wed Jun 24, 2009 4:48 pm    Post subject:
Reply with quote

Hi ,
Thanks icon_smile.gif
There are two flat files(PS)
I am using SYNCSORT and i would like to execute the above requirement using sort .

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jun 24, 2009 4:52 pm    Post subject:
Reply with quote

1. in your first post you mention that you only have one file,
normally the length precedes the data - how are you going to process this
after you insure that the field length is accurate?

will you have any data that exceeds 9 char?

2. in your second post you mention two files.



what are your requirements?
Back to top
View user's profile Send private message
Sandeep D. Patil

New User


Joined: 29 Jun 2008
Posts: 23
Location: mumbai

PostPosted: Wed Jun 24, 2009 4:58 pm    Post subject:
Reply with quote

No, Actually one if input and one is output file
See the file structure is the same as I mentioned above if the length of the col1 data is equal to the value of the col2 then the prog continues but if the length of the col1 variable does not match with the value of the col2 data then it changes the value of the col2 data with the actual length of the col1 variable

e.g

its reading one by one record in the file

if the length of var1 = var2
continue
else
move length of var1 to var2


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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jun 24, 2009 5:02 pm    Post subject:
Reply with quote

you did not answer my question about any col1 > 9 char.

and will the always only be one space between col1 and col2?

and what will process the output of the validation/correction step?
Back to top
View user's profile Send private message
Sandeep D. Patil

New User


Joined: 29 Jun 2008
Posts: 23
Location: mumbai

PostPosted: Wed Jun 24, 2009 5:27 pm    Post subject:
Reply with quote

Quote:
you did not answer my question about any col1 > 9 char.

and will the always only be one space between col1 and col2?

and what will process the output of the validation/correction step?




Consider this my file declaration

01 file-ip
05 data Pic x(70)
05 length-data pic 9(10)

Now this is the file, and the length of the data may vary from record to record .
I have check for the record length of the data and match with the value of length-data

If correct then no problem it continues and read the next record
If incorrect then change the value of length data with the actual length of the data variable

I Hope this will answer you my question 
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jun 24, 2009 5:42 pm    Post subject:
Reply with quote

will there be any imbedded spaces in the 'data' field?

what char are to be considered as data when determining the length?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Jun 24, 2009 5:49 pm    Post subject:
Reply with quote

This thread is too confusing -- I read the thread many many times, what's the motive after all?
Back to top
View user's profile Send private message
Sandeep D. Patil

New User


Joined: 29 Jun 2008
Posts: 23
Location: mumbai

PostPosted: Wed Jun 24, 2009 5:56 pm    Post subject:
Reply with quote

No there will not be any spaces
Back to top
View user's profile Send private message
Sandeep D. Patil

New User


Joined: 29 Jun 2008
Posts: 23
Location: mumbai

PostPosted: Wed Jun 24, 2009 5:57 pm    Post subject:
Reply with quote

can any one just tell me how to get the record length of the variable using the sort
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2165
Location: @my desk

PostPosted: Wed Jun 24, 2009 6:05 pm    Post subject:
Reply with quote

Sandeep D. Patil wrote:
can any one just tell me how to get the record length of the variable using the sort
Sandeep D. Patil,

If you could tell something about the business requirement behind this, somebody might be able to offer better suggestions. What exactly are you trying to achieve here? Why do you want to find the length of a field?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jun 24, 2009 6:07 pm    Post subject:
Reply with quote

ok, only one more question:
Quote:
what char are to be considered as data when determining the length?
Back to top
View user's profile Send private message
Sandeep D. Patil

New User


Joined: 29 Jun 2008
Posts: 23
Location: mumbai

PostPosted: Thu Jun 25, 2009 9:55 am    Post subject:
Reply with quote

Hi,

I have requirement as we are getting a file from the business and the file contains the data as well as the length of the data …. As mentioned above .
Now my requirement is that I need to check the data is proper or not. Like in case to match the length of the data and the value which I am getting from the business.

Like for e.g.

File 1

Data1 Value1
Pic x(70) Pic 9(10)
ABCD 4
Xyz 4

Now what I want is like that output should come as

o/p
File 2
Data1 Value1
Pic x(70) Pic 9(10)
ABCD 4
Xyz 3

Now I want where ever the length of the data1 is now equal to the value of the length coming from the business I need to change the length as I did in the e.g for the “Xyz

I hope this would be enough

Thanks
Back to top
View user's profile Send private message
Sandeep D. Patil

New User


Joined: 29 Jun 2008
Posts: 23
Location: mumbai

PostPosted: Thu Jun 25, 2009 4:41 pm    Post subject:
Reply with quote

Please reply
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 25, 2009 4:55 pm    Post subject:
Reply with quote

it is not even 7 o'clock in the states.
try e-mailing Brian Wood with the url of this thread which is:
http://ibmmainframes.com/viewtopic.php?p=196427&sid=400ee5868def87e5b95e4514cc7cca4b#196427

SyncSort Mainframe Product Services
brian.wood@syncsort.com
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Thu Jun 25, 2009 6:26 pm    Post subject: Reply to: Finding the Record Length
Reply with quote

Quote:
Please reply

please do not pester

remember... replying is on
voluntary effort
responder time
no charge
available knowledge
( the only time spent is in replying, not researching )

if You/Your_organization are in need for a fast solution
it would be better to evaluate a pay_for approach
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2165
Location: @my desk

PostPosted: Mon Jun 29, 2009 7:40 pm    Post subject:
Reply with quote

Sandeep D. Patil,

May be you can give this a try.
Code:
//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                       
AAAAAAAAAAAAAA                                       
BBBBBBBBBB                                           
CCCC                                                 
DD                                                   
//SORTOUT  DD DSN=&&T1,DISP=(,PASS)                   
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  OUTFIL BUILD=(1,70),FTOV,VLTRIM=C' '               
//STEP0200 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD DSN=&&T1,DISP=(OLD,PASS)               
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  OUTREC BUILD=(5,70,1,2,BI,SUB,+4,M11,LENGTH=10),VTOF

SORTOUT
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
AAAAAAAAAAAAAA                                                        0000000014
BBBBBBBBBB                                                            0000000010
CCCC                                                                  0000000004
DD                                                                    0000000002
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Mon Jun 29, 2009 8:02 pm    Post subject:
Reply with quote

It seems to me that someone has put the cart before the horse here (ie.e the data befiore its length).

From the description, the length field would appear to be at a varibale location. If so, we first need to know the length of the data so we can locate the field that contains the length!!!. Best of luck with that!

Otherwise we could be looking at a case where the data is a variable-length within a fixed-length field and the length field tells us how much to substring out from that field, in which case the remainder would likely be nulls or blanks.

Garry.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm


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