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

SORT JCL - SORTING A VB FILE - INREC OUTREC PARSE BUILD

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
ambilileela
Member


Joined: 06 Jun 2006
Posts: 11

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

PostPosted: Thu Sep 28, 2006 1:33 pm    Post subject: SORT JCL - SORTING A VB FILE - INREC OUTREC PARSE BUILD Reply with quote

Hi,

I want to sort a VB formatted file and remove the duplicates after summing up the amount. For e.g.. I have a file having 4 fields in it. Lets say Emp#, Empname, Account, Salary. The records are like:

36,sar,rte,456
45,amb,,698
36,sar,rte,400
45,amb,rte,600

I want to sort the above file so that my O/P looks like :

36,sar,rte,856
45,amb,,698
45,amb,rte,600

So, basically I want to get a sum of the amount fileds of the records that has the same value for all other fields.
It is easy for FB file but since my VB file does not have the same length for all the records, I am not able to do it Sad . Please help.

Thanks,
Ambili.
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.

Krishna
Site Admin


Joined: 27 Jan 2006
Posts: 1051

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

PostPosted: Thu Sep 28, 2006 3:50 pm    Post subject: Variable length files Reply with quote

Hi ambilileela,


My suggestion is to use cobol program to create FB file and then use SORT to get result.

we can sort VB file by giving starting position as actual starting pos + 4 in sort card.


Following Link may be useful to you

Smart DFSORT Tricks
http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

Thanks,
Krishna
Back to top
View user's profile Send private message Send e-mail
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
1 votes
Not an useful post
Greate Post!! Salute Author
2 salutes

PostPosted: Thu Sep 28, 2006 9:12 pm    Post subject: Reply with quote

Actually, this is a comma separated value (CSV) file. It has fields with variable positions. It might also be a VB file but I'm guessing it's really an FB file.

You can use the following DFSORT job to do what you asked for. However, you'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's PARSE and SQZ functions. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

If the input file is actually VB, let me know and I'll show you how to change the job to handle that.


Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
36,sar,rte,456
45,amb,,698
36,sar,rte,400
45,amb,rte,600
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=5),
               %02=(ENDBEFR=C',',FIXLEN=5),
               %03=(ENDBEFR=C',',FIXLEN=5),
               %04=(FIXLEN=5)),
        BUILD=(1:%01,C',',
               7:%02,C',',
              13:%03,C',',
              19:%04,UFF,TO=ZD,LENGTH=5)
  SORT FIELDS=(1,5,CH,A,7,5,CH,A,13,5,CH,A)
  SUM FIELDS=(19,5,ZD)
  OUTREC OVERLAY=(19:19,5,ZD,TO=FS,LENGTH=5,
        1:1,23,SQZ=(SHIFT=LEFT))
/*

_________________
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.
Krishna
Site Admin


Joined: 27 Jan 2006
Posts: 1051

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

PostPosted: Fri Sep 29, 2006 10:38 am    Post subject: Reply with quote

Thanks Frank.


Thanks,
Krishna
Back to top
View user's profile Send private message Send e-mail
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
ambilileela
Member


Joined: 06 Jun 2006
Posts: 11

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

PostPosted: Fri Sep 29, 2006 11:56 am    Post subject: Reply with quote

It is a VB file only. So, please let me know the code for a VB file.

Thanks,
Ambili
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
2 salutes

PostPosted: Fri Sep 29, 2006 8:40 pm    Post subject: Reply with quote

This version of the DFSORT job will work for a VB file. Remember that you need the April, 2006 DFSORT PTF. The job won't work without it.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...    input file (VB)
//SORTOUT DD DSN=...   output file (VB)
//SYSIN    DD    *
  INREC PARSE=(%01=(ABSPOS=5,ENDBEFR=C',',FIXLEN=5),
               %02=(ENDBEFR=C',',FIXLEN=5),
               %03=(ENDBEFR=C',',FIXLEN=5),
               %04=(FIXLEN=5)),
        BUILD=(1,4,
               5:%01,C',',
              11:%02,C',',
              17:%03,C',',
              23:%04,UFF,TO=ZD,LENGTH=5)
  SORT FIELDS=(5,5,CH,A,11,5,CH,A,17,5,CH,A)
  SUM FIELDS=(23,5,ZD)
  OUTREC OVERLAY=(23:23,5,ZD,TO=FS,LENGTH=5,
        5:5,23,SQZ=(SHIFT=LEFT))
  OUTFIL VLTRIM=C' '
/*

_________________
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.
academyindia4
Guest





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

PostPosted: Mon Jan 25, 2016 11:08 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





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

PostPosted: Wed Feb 03, 2016 1:07 am    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
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
Page 1 of 1



 
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 Search Batch file-aid help 14 frenchman 31561 Mon Feb 01, 2016 10:23 pm
academyindia4 View latest post
No new posts File-Aid Help 3 Nicholas 21374 Mon Feb 01, 2016 10:22 pm
academyindia4 View latest post
No new posts Hi plz help me out 7 Guest 21197 Mon Feb 01, 2016 10:14 pm
academyindia4 View latest post
No new posts Need urgent HELP 4 Sulagna 12528 Mon Feb 01, 2016 1:39 am
academyindia4 View latest post
This topic is locked: you cannot edit posts or make replies. executing java program thru JCL 6 Guest 24809 Tue Feb 12, 2013 1:56 pm
Anuj Dhawan 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-1150.html