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

Ways to merge the parts of different rows in the single row.

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


Joined: 26 Feb 2015
Posts: 2

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

PostPosted: Thu Feb 26, 2015 1:36 pm    Post subject: Ways to merge the parts of different rows in the single row. Reply with quote

Input
====
ABCD sdfsdf klsdfsdf
dfsdfs 12345 dfsdfdf
sdfsdf sdfsdf ******

BDCF dfsdffl dfsdfsdf
sdfsd 67893 dfgdfgd
asdas sdfsd $$$$$

Output
====
ABCD,12345,******
BDCF,67893,$$$$$

Hi All,

I am pretty new to DFsort and been working for just last week. I couldn't find the exact same query, have pasted the required results here.

This is ths sort card, but not giving the desired results


SORT FIELDS=(COPY)
OUTREC FIELDS=(1:5,35,38:30,13,55:35,17)

But i need to use this conditional outrec so that part from different rows is merged into songle row.
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.

William Collins
Active Member


Joined: 24 May 2012
Posts: 714

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

PostPosted: Thu Feb 26, 2015 4:13 pm    Post subject: Reply with quote

OUTREC has no special power. It is the same as INREC (assuming DFSORT), but operates after SORT/MERGE. Without SORT/MERGE, use INREC.

FIELDS is old and overloaded. Use BUILD instead. BUILD is a synonym for FIELDS, so operation is 100% identical, but it is not overloaded: when you see BUILD on INREC, OUTREC and OUTFIL it is less confusing than seeing FIELDS, FIELDS and OUTREC, and also seeing FIELDS on SORT/MERGE, REFORMAT, SUM, etc.

Those are tips. They don't affect what you want.

Assuming that you can guarantee groups of three records (or four if that blank is really there), it is WHEN=GROUP that you want.

You'll need to temporarily add a sequence number to the record. When it is exactly divisible by three (or four) , WHEN=GROUP to identify that and PUSH the data you want from the first record at to an extension of the record, with RECORDS=3.

When it is divisible by three (or four) with remainder one, WHEN=GROUP to identify that and PUSH the data you want from the second record to a separate extension.

When it is divisible with remainder two, use BUILD to format the output that you want from the three pieces of data that you have access to at the time: the third record; the data PUSHed from the first record; the data PUSHed from the second record.

Use OUTFIL INCLUDE=/OMIT= to select the third record of each group. If there is a blank record that you need, you can either INCLUDE=/OMIT= that as well, or generate it on a BUILD in OUTFIL using the slash operator (/).

Look for the DFSORT Getting Started manual, it is aimed exactly at people in your situation and has many useful examples. Full details of everything are in the DFSORT Application Programming Guide.
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.
Josdirut
Member


Joined: 13 Mar 2015
Posts: 2

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

PostPosted: Fri Mar 13, 2015 9:03 am    Post subject: Reply with quote

It is very interesting yet to forward the message.
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.
ashank.agarwal@tcs.com
Member


Joined: 26 Feb 2015
Posts: 2

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

PostPosted: Mon Mar 23, 2015 12:52 pm    Post subject: Reply with quote

Thanks William for useful insights and suggestions. I was side tracked untill i came across again same task last week.

I got around the situation using the ICETOOL. Again it was first attempt for me in ICETOOL but it's really useful. I used temp seq no. and ID field before creating Output. And the actual data pos i gave in WITH parameters. I needed a CSV output, so added a , after each block while creating outrec.

//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(120,2,ZD) KEEPNODUPS WITHANY -
WITH(68,20) WITH(89,17) USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFOUTLEN=133,
IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(120:ID=2,131:SEQ=1)),
IFTHEN=(WHEN=(131,1,ZD,EQ,2),BUILD=(68:30,20,120:120,2)),
IFTHEN=(WHEN=(131,1,ZD,EQ,3),BUILD=(89:35,17,120:120,2))
OUTFIL FNAMES=OUT,BUILD=(1,87,C',',89,17,C',',107,27)


Thanks,
Ashank
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
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 What are all the COBOL compilers available? 6 Sweetu 14669 Mon Feb 01, 2016 10:48 pm
academyindia4 View latest post
No new posts Reg: Different operating systems in mainframes 2 156138 6808 Mon Feb 01, 2016 1:35 am
academyindia4 View latest post
No new posts compare 2 files with different LRECL 13 nina 17200 Mon Feb 01, 2016 1:34 am
academyindia4 View latest post
No new posts Different forms of Case -when (loop handling) in Eazytrieve 3 Avani 10392 Mon Feb 01, 2016 1:34 am
academyindia4 View latest post
No new posts Copy records for matching key appearing at different places. 4 rangab 7444 Tue Feb 03, 2009 11:36 pm
rangab 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-7833.html