Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M

Google
 
Web mainframegurukul.com

Variable length field from a file using SORT
Goto page 1, 2  Next
 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
subasu
Member


Joined: 24 Mar 2009
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 1:21 pm    Post subject: Variable length field from a file using SORT Reply with quote

I have a requirement where I need to pick up a numeric value from a variable length field from a file. Is this possible using DFSORT? Like the in screenshot, the value 29 could be 329 or 2329 or 899033. There is no limit to the number.

"Loaded 29 rows into the database"
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 2:25 pm    Post subject: Reply with quote

is it delimited file?. example shown below.

12,343435,343527664
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
subasu
Member


Joined: 24 Mar 2009
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 2:29 pm    Post subject: Reply with quote

It is a dataset... which has a number of records... one of its lines contains information on the number of rows loaded to a system.... I need this count... its a numeric field and has variable length.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 2:32 pm    Post subject: Reply with quote

In that case.. There should be a standard string like 'NO OF RECORDS LOADED'
do you have this kind of string in that line along with your numeric field.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
subasu
Member


Joined: 24 Mar 2009
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 2:34 pm    Post subject: Reply with quote

The specific line only has the below details:

"Loaded 47 rows into the database" ... this value 47 could be of variable length... it can be 7 or 47 or 847 or 9847 and so on....
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
dbzTHEdinosauer
Moderator


Joined: 02 Oct 2006
Posts: 975

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 3:15 pm    Post subject: Reply with quote

if the word 'Loaded ' in position 1 of a record, only in 1 record of the file?

is it, perchance, always the first or last record?
how many records could there be in this file?
_________________
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
subasu
Member


Joined: 24 Mar 2009
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 3:21 pm    Post subject: Reply with quote

There is only 1 line in the dataset where the word "Loaded " is present begining from the 1st position... the one which I require. This is neither the first or last record. There will be only 1 such record in the file.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
dbzTHEdinosauer
Moderator


Joined: 02 Oct 2006
Posts: 975

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 3:37 pm    Post subject: Reply with quote

other than not knowing the dcb attributes of the file,
we only need to know
Quote:
I need to pick up a numeric value from a variable length field from a file


what do you want to do with the numeric value?
_________________
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
subasu
Member


Joined: 24 Mar 2009
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 3:39 pm    Post subject: Reply with quote

I need this numeric value and replace this value in another file.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
dbzTHEdinosauer
Moderator


Joined: 02 Oct 2006
Posts: 975

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 4:01 pm    Post subject: Reply with quote

Quote:
I need this numeric value and replace this value in another file.


as I am off today, I don't mind this silliness, too much.

'replace'?

where, what? what are the dcb attributes of this 'other file'? (actually both files!)
what position do you want overlayed with this extract numeric value?

why don't you have the originator of the file containing the 'LOADED' also do this replacement?
_________________
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 4:31 pm    Post subject: DFSPRT INCLUDE OUTREC FINDREP INOUT Reply with quote

Please check this sort card... i did not tested this card..

Code:

//SYSIN    DD *
    SORT FIELDS=COPY
     INCLUDE COND=(1,6,CH,EQ,C'Loaded')
     OUTREC FINDREP=(INOUT=(C'LOADED',C'',C'rows into the database',C''))
/*



It will place required record into output file. by replacing the string
with spaces.

Input file
asdfdssfsfsdf
Loaded 47 rows into the database
asdfsfdssadf


Output file
47
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Mar 24, 2009 8:41 pm    Post subject: Reply with quote

subasu,

You can use a DFSORT job like the following to write a record with the extracted number as 10 digits with leading zeros. I assumed your largest number is 10 digits but you can change that if appropriate.

Code:

//S1    EXEC  PGM=SORT                                       
//SYSOUT    DD  SYSOUT=*                                     
//SORTIN DD *                                               
... record                                                   
... record                                                   
Loaded 29123 rows into the database                         
... record                                                   
... record                                                   
//SORTOUT DD DSN=...  output file (FB/80)                                       
//SYSIN    DD    *                                           
  OPTION COPY                                               
  INCLUDE COND=(1,6,CH,EQ,C'Loaded')                         
  INREC PARSE=(%01=(ABSPOS=8,ENDBEFR=C' ',FIXLEN=10)),       
    BUILD=(%01,UFF,M11,LENGTH=10,80:X)                       
/*


For the example give, SORTOUT would have:

0000029123

For an input record of:

Loaded 29 rows into the database

SORTOUT would have:

0000000029

and so on.

You can change this job appropriately for what you want to do (which isn't clear).
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
subasu
Member


Joined: 24 Mar 2009
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Mar 25, 2009 11:43 am    Post subject: Reply with quote

Thanks for your promt replies.... probably I should have stated my requirements more clearly for everyone's understnading...

One file of FB/133 has the line which details the record count.... this count has to be picked up and replaced in another file FB/80.

Input FIle: FB-133
.......
.........
Loaded 29 rows into the database
....
....

O/P file:
FILEID001 0000000

This 7 digit value of 0000000 has to be replaced from the count in the input file.

dbzTHEdinosauer - Sorry for not making the requirements clear. I hope now you have a clearer understanding.

Natarajan - The INREC record was giving an error

Frank - You are the champ... it worked!!!! I need to replace this value in another file, which contains only 1 record, in the first line from the position 11 to 17 in the output file.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Mar 25, 2009 9:28 pm    Post subject: Reply with quote

subasu,

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB/133)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(1,6,CH,EQ,C'Loaded')
  INREC PARSE=(%01=(ABSPOS=8,ENDBEFR=C' ',FIXLEN=7)),
    BUILD=(C'NEWCT,''',%01,UFF,M11,LENGTH=7,C'''',80:X)
/*
//S2    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file2 (FB/80)
FILEID001 0000000
/*
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC OVERLAY=(11:NEWCT)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
subasu
Member


Joined: 24 Mar 2009
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Mar 26, 2009 11:54 am    Post subject: Reply with quote

Thanks Frank... it worked.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Goto page 1, 2  Next
Page 1 of 2



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts REMOVE HIGH VALUE FROM THE EXTRACT FILE 2 Guest 6920 Fri May 09, 2008 11:04 am
Krishna View latest post
No new posts Redefine with the larger value. 5 sjadhav 7519 Wed Mar 28, 2007 4:52 am
DavidatK View latest post
No new posts Inserting NULL 5 jaydeeppal 10642 Tue Oct 17, 2006 6:41 pm
dbzTHEdinosauer View latest post
No new posts sink value 0 padmapriya7 3312 Fri Mar 03, 2006 5:42 pm
padmapriya7 View latest post
No new posts query regarding matching field value 3 jasveer 5981 Mon Feb 20, 2006 3:51 pm
jasveer View latest post
 


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-3850.html