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
 

 

I have a file in which there is a field called claims

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

New User


Joined: 11 Apr 2006
Posts: 8
Location: Pune

PostPosted: Thu May 18, 2006 1:45 pm    Post subject: I have a file in which there is a field called claims
Reply with quote

Hi ,

I have a file in which there is a field called claims and there are other fields. I have to put a comma after each value that occurs in claims feild?
I have to put this comma in all the lines except the last one.eg,

Code:

Claims        name     age
12345,        a        20
56789,        b        23
11991         c        25


hope this summarises the situation. ( this file is crated by fetching the results of a query into a dataset , so i know the no of lines in a file )?
Can somebody throw some light how this can be accomplished in sort or
any other utilities?
Thanks and Regards,
Deepti
Back to top
View user's profile Send private message

hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu May 18, 2006 2:40 pm    Post subject: Re: Sort
Reply with quote

Hi,

i think this can be easliy done thru OUTREC if claims field is of fix length

eg claims field is of length =6

SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,6,C',',8:7,73)

i dont know exactly how to skip this action for last record .
plz check this out if it helps u .

Thanks ,
-Kapil.
Back to top
View user's profile Send private message
Deepti Bhopatkar

New User


Joined: 11 Apr 2006
Posts: 8
Location: Pune

PostPosted: Thu May 18, 2006 2:55 pm    Post subject: Re: Sort
Reply with quote

Hi ,

Let me modify the query .
1. The addition of comma can be done thru outrec.
2. The omission of last row can be achieved by STOPREC.
However the problem that now i am facing is that it is a productionised job and hence the count ( i.e no of records in the file ) will change daily ?
hence i cant hardcode any value for stoprec in the sortcard nor i can give any symobolic.

Hope this summarises the problem.

Thanks and Regards,
Deepti
Back to top
View user's profile Send private message
rajandhla

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Thu May 18, 2006 3:03 pm    Post subject:
Reply with quote

Is the file contains key on which we can sort
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu May 18, 2006 8:58 pm    Post subject:
Reply with quote

Deepti,

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//STEP1 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//S1 DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
* Add seqnum at end of records.
  INREC OVERLAY=(81:SEQNUM,8,ZD)
* T1 has records with seqnums.
  OUTFIL FNAMES=T1
* S1 has a symbol as follows:
* LASTRCD,+n
* where n is the seqnum of the last record.
  OUTFIL FNAMES=S1,REMOVECC,NODETAIL,
    OUTREC=(80X),
    TRAILER1=('LASTRCD,+',81,8)
/*
//STEP2 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
* Add a comma for every record except the record
* whose seqnum is LASTRCD.  Remove seqnum.
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=(81,8,ZD,NE,LASTRCD),
      OVERLAY=(6: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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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