we have input file like this.first we have to check the first 4 digit length before comma if 4 digit length found then we have to remove the first digit and added zero in the second digit postion.other case suppose three digits only before comma then we have add first digit as zero.we have to verify lengh of digits after comma ,if lengh less than 15 then we have to add leading zeros after comma
I/P
3290,9174990831
3290,1775998230
4560,7000135
3290,6500007975
101,8868000005
O/P
090,000009174990831
001,000008868000005
add leading zero's to output file based on certain condition
-
- Global moderator
- Posts: 3720
- Joined: Sat Dec 19, 2009 8:32 pm
- Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
- Referer: other forum
- Location: Dubuque, Iowa, USA
Re: add leading zero's to output file based on certain condi
Why do you have 5 input and 2 output records? You did not indicate in your post any exclusion conditions so 5 records input should be 5 records output.
Furthermore, you posted in the JCL section and JCL cannot do this. You can write a program in the language of your choice to do it, or you might be able to use a utility (such as your sort product) to do it, but definitely JCL cannot do it.
Furthermore, you posted in the JCL section and JCL cannot do this. You can write a program in the language of your choice to do it, or you might be able to use a utility (such as your sort product) to do it, but definitely JCL cannot do it.
-
- Posts: 25
- Joined: Tue Sep 18, 2018 8:05 pm
- Skillset: jcl,vsam,cobol,db2,rexx
- Referer: google
Re: add leading zero's to output file based on certain condi
Hi Robert
that sample out put .please see below corercted input and output. we have do in JCl only only.the last 10 digidt are account number we have 5 zeros before account number.
I/P
3290,9174990831
101,8868000005
O/P
090000009174990831
001000008868000005
that sample out put .please see below corercted input and output. we have do in JCl only only.the last 10 digidt are account number we have 5 zeros before account number.
I/P
3290,9174990831
101,8868000005
O/P
090000009174990831
001000008868000005
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: add leading zero's to output file based on certain condi
As stated by Robert JCL cannot do this.
Now, presumably you want to do this using your sort utility. Which one is it? DFSort or SyncSort?
Many people seem to mis-understand what JCL is.
Although the 'L' in JCL stands for 'Language' JCL is not executable.
JCL does not manipulate data, it does not even look at data.
JCL is like a memo from you to the Operating System (OS) requesting it (the OS) to run one or more programs.
The JCL specifies some, or all, of the resources required to accomplish the requested tasks.
When the JCL is read the OS reads it and sets up whatever it requires to do the tasks defined in the JCL.
It then DISCARDS the JCL, i.e. writes it to the output spool, never to look at it again.
The OS then runs the program(s) in accordance with the information it has extracted.
Now, presumably you want to do this using your sort utility. Which one is it? DFSort or SyncSort?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
Re: add leading zero's to output file based on certain condi
It is really so important that you state your requirement accurately - we do appreciate that there may be a language problem, so do try to accomodate this .................. but
first we have to check the first 4 digit length before comma if 4 digit length found then we have to remove the first digit and added zero in the second digit postion.
3290,9174990831 - remove first digit = 290,9174990831 - then added zero in second digit position
- Do you mean mathematically added, in which case why bother - or physically inserted ?
Your example output shows that the first digit from the revised data has replaced by the zero
From what you have written I would have inserted a zero into the second position and ended up with 2090,9174990831
Also, your second example of output seems to have lost the comma. is this new or a typo ?
first we have to check the first 4 digit length before comma if 4 digit length found then we have to remove the first digit and added zero in the second digit postion.
3290,9174990831 - remove first digit = 290,9174990831 - then added zero in second digit position
- Do you mean mathematically added, in which case why bother - or physically inserted ?
Your example output shows that the first digit from the revised data has replaced by the zero
From what you have written I would have inserted a zero into the second position and ended up with 2090,9174990831
Also, your second example of output seems to have lost the comma. is this new or a typo ?
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: add leading zero's to output file based on certain condi
Here is rexx solution using your revised sample data:
Output is
Code: Select all
my_input.1 = "3290,9174990831"
my_input.2 = "101,8868000005"
Do ix = 1 To 2
Parse var my_input.ix first_part ',' second_part
first_part = Right(Right(first_part,2),3,0)
second_part = Right(second_part,15,0)
my_output.ix = first_part||second_part
End
Say my_output.1
Say my_output.2
Exit
Output is
Code: Select all
090000009174990831
001000008868000005
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
-
- Posts: 25
- Joined: Tue Sep 18, 2018 8:05 pm
- Skillset: jcl,vsam,cobol,db2,rexx
- Referer: google
Re: add leading zero's to output file based on certain condi
expat wrote:It is really so important that you state your requirement accurately - we do appreciate that there may be a language problem, so do try to accomodate this .................. but
first we have to check the first 4 digit length before comma if 4 digit length found then we have to remove the first digit and added zero in the second digit postion.
3290,9174990831 - remove first digit = 290,9174990831 - then added zero in second digit position
- Do you mean mathematically added, in which case why bother - or physically inserted ?
Your example output shows that the first digit from the revised data has replaced by the zero
From what you have written I would have inserted a zero into the second position and ended up with 2090,9174990831
Also, your second example of output seems to have lost the comma. is this new or a typo ?
Thanks for reply..please can post the JCL code..this is my clear requirement...
the first four digits are bank number so some times bank number is four digits or three digits.
if four digits then remove the first two digits and add zero leading
if three digits then remove or replace first digit and add zero leading
the comma shoundnot get in the out put file
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: add leading zero's to output file based on certain condi
please can post the JCL code..this is my clear requirement.
and you have been clearly told that JCL can not do this.
Assuming you want a sort solution here is a sample JCL to run when you have the sort control statements
Code: Select all
//STEP EXEC PGM=SORT
//SORTIN DD DSN=your.input.data. set,DISP=SHR
//SORTOUT DD DSN=your.output.data. set,DISP=(,CATLG,CATLG),
// RECFM=recorfm,LRECL=lrecl,SPACE=your space requirement
//SYSIN DD *
sort control statements - these are NOT JCL
/*
//SYSOUT DD SYSOUT=*
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
-
- Posts: 25
- Joined: Tue Sep 18, 2018 8:05 pm
- Skillset: jcl,vsam,cobol,db2,rexx
- Referer: google
Re: add leading zero's to output file based on certain condi
HI NIC
i did in JCL only the above requirement.please see the below code.
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(5,1,CH,EQ,C','),
BUILD=(1:C'0',2:3,2,4:6,15,UFF,M11,LENGTH=15)),
IFTHEN=(WHEN=(4,1,CH,EQ,C','),
BUILD=(1:C'0',2:2,2,4:5,15,UFF,M11,LENGTH=15))
o/p file
090000006500012315
001000008868000123
i did in JCL only the above requirement.please see the below code.
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(5,1,CH,EQ,C','),
BUILD=(1:C'0',2:3,2,4:6,15,UFF,M11,LENGTH=15)),
IFTHEN=(WHEN=(4,1,CH,EQ,C','),
BUILD=(1:C'0',2:2,2,4:5,15,UFF,M11,LENGTH=15))
o/p file
090000006500012315
001000008868000123
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: add leading zero's to output file based on certain condi
This line is JCL:
These lines are NOT JCL - they are sort control statements:
And use the code tags when presenting code and data.
Code: Select all
//SYSIN DD *
These lines are NOT JCL - they are sort control statements:
Code: Select all
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(5,1,CH,EQ,C','),
BUILD=(1:C'0',2:3,2,4:6,15,UFF,M11,LENGTH=15)),
IFTHEN=(WHEN=(4,1,CH,EQ,C','),
BUILD=(1:C'0',2:2,2,4:5,15,UFF,M11,LENGTH=15))
And use the code tags when presenting code and data.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
-
- Similar Topics
- Replies
- Views
- Last post
-
-
File Handling 3 input files and 1 output file by using EZT
by pavan426 » Thu Sep 09, 2021 12:17 am » in CA-Easytrieve - 0
- 4404
-
by pavan426
View the latest post
Thu Sep 09, 2021 12:17 am
-
-
-
Create multiple records based on one record within a file.
by chillmo » Thu Aug 11, 2022 3:54 am » in Syncsort/Synctool - 5
- 7668
-
by sergeyken
View the latest post
Fri Aug 12, 2022 2:23 am
-
-
-
Can i read output file created after SORTing in the same pgm
by savitha_y » Sat Feb 06, 2021 1:17 am » in IBM Cobol - 4
- 1597
-
by savitha_y
View the latest post
Tue Feb 09, 2021 7:11 pm
-
-
-
Using nice/renice commands on USS leading to MSG FSUMF022
by Marcels68 » Sat Oct 12, 2024 4:02 pm » in Operating Systems - 0
- 1779
-
by Marcels68
View the latest post
Sat Oct 12, 2024 4:02 pm
-
-
-
remove leading special chars, space & trailing special char
by srihemz » Tue Jun 30, 2020 8:06 pm » in DFSORT/ICETOOL/ICEGENER - 2
- 3840
-
by sergeyken
View the latest post
Wed Jul 01, 2020 4:55 pm
-