Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Add Comma to each record until find the next client number

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
naveensrimf

New User


Joined: 04 Oct 2005
Posts: 33

PostPosted: Sat Jul 28, 2018 12:25 am    Post subject: Add Comma to each record until find the next client number
Reply with quote

Hi,

Add comma to each record until find the next client number in file

File contain date,org name,client number, email id etc...

Input
---------

20180720 XYZCOMPANY 145678 ABC@EMAIL.COM
20180721 XYZCOMPANY 145678 ABC@EMAIL.COM
20180722 XYZCOMPANY 145678 ABC@EMAIL.COM
20180723 XYZCOMPANY 145678 ABC@EMAIL.COM

20180720 XYZCOMPANY 145685 ABC@EMAIL.COM
20180721 XYZCOMPANY 145685 ABC@EMAIL.COM

20180722 XYZCOMPANY 145687 ABC@EMAIL.COM
20180723 XYZCOMPANY 145688 ABC@EMAIL.COM

Output like this
==========
20180720 XYZCOMPANY 145678 ABC@EMAIL.COM,
20180721 XYZCOMPANY 145678 ABC@EMAIL.COM,
20180722 XYZCOMPANY 145678 ABC@EMAIL.COM,
20180723 XYZCOMPANY 145678 ABC@EMAIL.COM

20180720 XYZCOMPANY 145685 ABC@EMAIL.COM,
20180721 XYZCOMPANY 145685 ABC@EMAIL.COM

20180722 XYZCOMPANY 145687 ABC@EMAIL.COM
20180723 XYZCOMPANY 145688 ABC@EMAIL.COM
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 444
Location: USA

PostPosted: Sat Jul 28, 2018 1:55 am    Post subject: Reply to: Add Comma to each record until find the next client number
Reply with quote

Please send the requirements document and someone here will do the coding/testing for you.

Also, we'll let your boss know Not to bother you with such tasks and directly post on this forum.

.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1566
Location: Andromeda Galaxy

PostPosted: Sat Jul 28, 2018 2:05 am    Post subject:
Reply with quote

First Please take a few minutes to review your post before submit....

It is as if you are asking someone to do it here .. I find it rude at least...

To answer your question:

1. Your need to use ICETOOL for multiple passes along with joinkeys
2. First pass you need to prepare for //JNF1CNTL where JNF1CNTL should have your key and nth SEQUENCE number for each group (Ex: 145678 and 4 ) You need to do that using INREC + Adding SEQUNCE NUMBER + SORT descending based on Sequence number and SELECT first and assign to a temp file which would serve as you JNF1CNTL
3.Assign your original file for JNF2CNTL
4.Inrec add a sequnce to your original file
5.join both files based on client number
6. Reformat
7.When Sequence number matches from both the files dont add ',' else add
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Sat Jul 28, 2018 2:58 am    Post subject:
Reply with quote

Or you could do something like this by joining the same input to itself, which does not involve SORTing. I have assumed the input attributes to be FB/LRECL-80.
You could modify it as per your actual requirement.
Code:
//STEP01   EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTJNF1 DD *                               
20180720 XYZCOMPANY 145678 ABC@EMAIL.COM       
20180721 XYZCOMPANY 145678 ABC@EMAIL.COM       
20180722 XYZCOMPANY 145678 ABC@EMAIL.COM       
20180723 XYZCOMPANY 145678 ABC@EMAIL.COM       
20180720 XYZCOMPANY 145685 ABC@EMAIL.COM       
20180721 XYZCOMPANY 145685 ABC@EMAIL.COM       
20180722 XYZCOMPANY 145687 ABC@EMAIL.COM       
20180723 XYZCOMPANY 145688 ABC@EMAIL.COM       
//SORTJNF2 DD *                                   
20180720 XYZCOMPANY 145678 ABC@EMAIL.COM           
20180721 XYZCOMPANY 145678 ABC@EMAIL.COM           
20180722 XYZCOMPANY 145678 ABC@EMAIL.COM           
20180723 XYZCOMPANY 145678 ABC@EMAIL.COM           
20180720 XYZCOMPANY 145685 ABC@EMAIL.COM           
20180721 XYZCOMPANY 145685 ABC@EMAIL.COM           
20180722 XYZCOMPANY 145687 ABC@EMAIL.COM           
20180723 XYZCOMPANY 145688 ABC@EMAIL.COM           
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                               
 JOINKEYS FILE=F1,FIELDS=(81,8,A),SORTED,NOSEQCK             
 JOINKEYS FILE=F2,FIELDS=(81,8,A),SORTED,NOSEQCK             
 JOIN UNPAIRED,F1                                             
 REFORMAT FIELDS=(F1:1,80,F2:21,6,?)                         
 SORT FIELDS=COPY                                             
 INREC IFOUTLEN=80,                                           
       IFTHEN=(WHEN=(21,6,CH,EQ,81,6,CH),OVERLAY=(41:C','))   
//JNF1CNTL DD *                                               
 INREC OVERLAY=(81:SEQNUM,8,ZD)                               
//JNF2CNTL DD *                                               
 INREC OVERLAY=(81:SEQNUM,8,ZD,START=0) 
SORTOUT had:
Code:
20180720 XYZCOMPANY 145678 ABC@EMAIL.COM,
20180721 XYZCOMPANY 145678 ABC@EMAIL.COM,
20180722 XYZCOMPANY 145678 ABC@EMAIL.COM,
20180723 XYZCOMPANY 145678 ABC@EMAIL.COM
20180720 XYZCOMPANY 145685 ABC@EMAIL.COM,
20180721 XYZCOMPANY 145685 ABC@EMAIL.COM
20180722 XYZCOMPANY 145687 ABC@EMAIL.COM
20180723 XYZCOMPANY 145688 ABC@EMAIL.COM
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2098
Location: UK

PostPosted: Sat Jul 28, 2018 3:00 pm    Post subject: Reply to: Add Comma to each record until find the next client number
Reply with quote

After 13 years as a member of the forum you should know to use the code-tags when postings code, data, screenshots etc.
Also after so long in the industry you should know the difference between a data set and a file.
Back to top
View user's profile Send private message
naveensrimf

New User


Joined: 04 Oct 2005
Posts: 33

PostPosted: Mon Jul 30, 2018 7:32 pm    Post subject: Reply to: Add Comma to each record until find the next client number
Reply with quote

Thanks for the solution. Now my requirement is full filled.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2030
Location: NY,USA

PostPosted: Thu Aug 02, 2018 12:06 am    Post subject:
Reply with quote

If you don't care about the sort order then try below solution as well else add one more step to SORT it back to original order. If the records are more like in millions then probably this is not the right way to do it.
Code:
//STEP010  EXEC PGM=SORT
//SYSUDUMP DD  SYSOUT=*
//SYSOUT   DD  SYSOUT=*
//SORTIN   DD  *
20180720 XYZCOMPANY 145678 ABC@EMAIL.COM
20180721 XYZCOMPANY 145678 ABC@EMAIL.COM
20180722 XYZCOMPANY 145678 ABC@EMAIL.COM
20180723 XYZCOMPANY 145678 ABC@EMAIL.COM
20180720 XYZCOMPANY 145685 ABC@EMAIL.COM
20180721 XYZCOMPANY 145685 ABC@EMAIL.COM
20180722 XYZCOMPANY 145687 ABC@EMAIL.COM
20180723 XYZCOMPANY 145688 ABC@EMAIL.COM
//SORTOUT  DD  SYSOUT=*
//SYSIN    DD  *
   SORT FIELDS=(21,6,CH,A,50,2,ZD,D)
   INREC OVERLAY=(50:SEQNUM,2,ZD,RESTART=(21,6),41:C',')
   OUTREC OVERLAY=(60:SEQNUM,2,ZD,RESTART=(21,6))
   OUTFIL IFOUTLEN=41,
          IFTHEN=(WHEN=(60,2,ZD,EQ,1),OVERLAY=(41:C' '))
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Process only last key record in a fil... Naveen.katkuri24 DFSORT/ICETOOL 8 Tue Oct 09, 2018 9:39 am
No new posts Find out which PSB is currently sched... Andi1982 IMS DB/DC 0 Mon Sep 24, 2018 3:16 pm
No new posts How to find if segment is read in any... Priyanka AR IMS DB/DC 12 Thu Sep 20, 2018 1:34 pm
No new posts Number of Packages required for stati... manojthokala7 DB2 4 Mon Sep 17, 2018 7:14 pm
No new posts SYNCSORT keep MIN/MAX record Cloink SYNCSORT 16 Mon Sep 17, 2018 3:00 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us