Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all 8500 articles
Browse latest View live

DFSORT/ICETOOL :: RE: Performing arithmetic on input field

$
0
0
Author: Bill Woodger
Subject: Reply to: Performing arithmetic on input field
Posted: Thu Dec 08, 2016 4:24 am (GMT 5.5)

No-one locked anything, and that last comment wasn't mine :-)

Posts can only be edited by non-moderators for 10 minutes after they have been entered. If you can post (or PM) me a correction I can apply it and tidy up a bit.


DFSORT/ICETOOL :: RE: Performing arithmetic on input field

$
0
0
Author: zh_lad
Subject: Re: Reply to: Performing arithmetic on input field
Posted: Thu Dec 08, 2016 7:46 pm (GMT 5.5)

Hi Bill,

How will I deal with space when result of multiplication is only 1 digit.

Code:
1,1,UFF,MUL,+2,EDIT(IT)


How will I ignore space to pick up digits to sum in OUTREC (second IFTHEN).

Rohit was using FIND and REPLACE
Code:
OUTREC FINDREP=(INOUT=(C' ',C'')) 



Thanks.

Bill Woodger wrote:
IFTHEN=(WHEN=INIT for an OVERLAY to give you the several multiply-by-two results (they are not "intermediate results" in the sense normally used), then another WHEN=INIT with the BUILD to ADD all the digits that you need (odd-number from original location, even-numbered from the location OVERLAYed to) and then multiply that by +9.

DFSORT/ICETOOL :: RE: Performing arithmetic on input field

$
0
0
Author: Arun Raj
Posted: Thu Dec 08, 2016 7:55 pm (GMT 5.5)

zh_lad wrote:
How will I ignore space to pick up digits to sum in OUTREC (second IFTHEN).
This is already suggested above. Keep the results in 2-bytes and read as ZD or UFF (2 bytes)
Quote:
you can use TT...edits and read them as ZD in further computations or keep the IT...edits and read them as UFF, whichever works for you.

_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard

DFSORT/ICETOOL :: RE: Performing arithmetic on input field

$
0
0
Author: zh_lad
Posted: Thu Dec 08, 2016 8:58 pm (GMT 5.5)

My input:
Code:
518791041070069


I read more about having multiple IFTHEN and improved code to:
Code:
OPTION COPY                                       
INREC IFTHEN=(WHEN=INIT,                           
      BUILD=(1,1,UFF,MUL,+2,EDIT(IT),             
             2,1,UFF,MUL,+1,EDIT(T),               
             3,1,UFF,MUL,+2,EDIT(IT),             
             4,1,UFF,MUL,+1,EDIT(T),               
             5,1,UFF,MUL,+2,EDIT(IT),             
             6,1,UFF,MUL,+1,EDIT(T),               
             7,1,UFF,MUL,+2,EDIT(IT),             
             8,1,UFF,MUL,+1,EDIT(T),               
             9,1,UFF,MUL,+2,EDIT(IT),             
            10,1,UFF,MUL,+1,EDIT(T),               
            11,1,UFF,MUL,+2,EDIT(IT),             
            12,1,UFF,MUL,+1,EDIT(T),               
            13,1,UFF,MUL,+2,EDIT(IT),             
            14,1,UFF,MUL,+1,EDIT(T),               
            15,1,UFF,MUL,+2,EDIT(IT))),           
      IFTHEN=(WHEN=INIT,FINDREP=(INOUT=(C' ',C'')))


Result is:
Code:
10116718104201400618


number of digits in Result will vary based on input. How do I tell SORT to pick all the digits when adding them?

P.S. - I was amazed to know every IFTHEN picks up amendments done by previous IFTHEN. I didn't know that.

Thanks.

DFSORT/ICETOOL :: RE: Performing arithmetic on input field

$
0
0
Author: Arun Raj
Posted: Thu Dec 08, 2016 10:07 pm (GMT 5.5)

I think you got confused. Forget the FINDREP suggestion. You don't need FINDREP. I will repeat what was suggested already if that makes any clearer.

1 - In the first IFTHEN , multiply only the digits at odd positions(pos-1,3,5,..etc), which in the input are in ZD format (you don't need to multiply others by 1) and OVERLAY at the end of the record (say pos-81,83,85..etc), here either keep it edited as 'TT', or 'IT' so you can read them as ZD or UFF in the second IFTHEN.
To avoid confusion I'd recommend using TT, so you see ZEROes instead of blanks.

2 - In the second IFTHEN, ADD all the individual digits from the results above(pos-81,82,83,...etc) and the digits at even positions from your original input which is still available at pos-2,4,6,..etc. And include the MUL by 9 in the same calculation, edit the final result to format it as per your requirement.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard

DFSORT/ICETOOL :: RE: Performing arithmetic on input field

$
0
0
Author: Bill Woodger
Subject: Reply to: Performing arithmetic on input field
Posted: Thu Dec 08, 2016 10:40 pm (GMT 5.5)

zh_lad wrote:
I was amazed to know every IFTHEN picks up amendments done by previous IFTHEN


It is not the IFTHEN, it is the BUILD. Each BUILD that is executed creates a "new version" of the current record, from the previous version.

OVERLAY does not create a new version of the current records, but operates on the existing version.

Code:

BUILD=(21,20,1,20)
OVERLAY=(21,20,1,20)


Try those, the output will be different, because of the way BUILD and OVERLAY operate.

If you need to "rearrange" data, BUILD is more convenient. If you need to update data where it is, OVERLAY is 1) clearer and 2) performs better.

Other differences are that although you can specify columns in BUILD, you can only define fields in "ascending" order (the columns will just get space-padded if needed), whereas with OVERLAY you can specify the columns in any order, and even do multiple transformations to the same field in one OVERLAY, by specifying the same column multiple times.

Anyway, I'm assuming that was the confusion (how BUILD works), because it is entirely normal to expect something that has been changed to be available to the next line of code.

Note also that with IFTHEN=(WHEN=(logicalexpression), when one is true, no further IFTHEN=(WHEN=(logicalexpression) are processed for that "record", unless you ask for it, by using HIT=NEXT, and that includes if you want to use WHEN=ANY.

So one or more IFTHEN=(WHEN=(logicalexpression) are like a "case/select" statement (EVALUATE in COBOL).

DFSORT/ICETOOL :: Removing Duplicates based on certain value of the records

$
0
0
Author: chandracdac
Subject: Removing Duplicates based on certain value of the records
Posted: Fri Dec 09, 2016 4:40 am (GMT 5.5)

Hi All,

i want to apply my eliminate duplicate logic(sum fields=None or sortxsum using ICETOOL) on certain records from input and remaining records should be copied to out put as is.

something like this

input is
aaa 123 a1 testing1
aaa 123 a1 testing1
aaa 124 b1 testing1
aaa 124 b1 testing1

output should be

aaa 123 a1 testing1
aaa 124 b1 testing1
aaa 124 b1 testing1

so it is basically when field has value a1 i want to eliminate duplicates and at the same time i want all other records in my output file. i have tried select statement using CTL1 but i am missing something.

this is what i have tried

SELECT FROM(inputfile ) TO(outputfile)-
ON(01,03,CH) ON(04,03,CH) ON(09,08,CH)-
FIRST DISCARD(SORTXSUM)-
USING(CTL1)

and my CTL1 is

INCLUDE COND=(07,2,CH,EQ,C'a1')

i know this will select records with only a1 but i tried all other options too

DFSORT/ICETOOL :: RE: Removing Duplicates based on certain value of the records

$
0
0
Author: Bill Woodger
Subject: Reply to: Removing Duplicates based on certain value of the records
Posted: Fri Dec 09, 2016 5:14 am (GMT 5.5)

Can "a1" appear with other keys as well? If so, do you want to keep the first of each key, or only the first "a1"?

DFSORT/ICETOOL :: Unwrap the data based on delimiter X'25'

$
0
0
Author: bhavana yalavarthi
Subject: Unwrap the data based on delimiter X'25'
Posted: Fri Dec 09, 2016 10:25 am (GMT 5.5)

I have a input data like,

ISA*00* *00* *01*078769021 *16*054481205CPIC *16
9*U*00301*000000061*0*P*~GS*PS*078769021*054481205*161111*0229*61*X*00330*610001BFR*00**161110*DL*A*170201*170301*161110 N1*MI*Toyota Tsusho AInc.*92*311 LIN**VP*766325AA0AC*PO*20212149 UIT*LB PID*F*9B***CR SP122B
7.01 SDP*Y*Y FST*119049.642*C*D*170301**002*0229*DO*20212149 SDP*Y*Y FST2*D*D*170401**002*0229*DO*20212149 LIN**VP*781985AA0AC*PO*20212149 UIT*L
9B***GA SP781B .039 X 61.73 SDP*Y*Y FST*62986.07911*C*D*170301**002*0229
2149 SDP*Y*Y FST*74957.182*D*D*170401**002*0229*DO*20212149 LIN**VP*7811
PO*20212149 UIT*LB PID*F*9B***CR SP123B .028 X 57.01 SDP*Y*Y FST*39683.2


I want to unwrap the data such that ISA segment will come in one row,GS segment in one row and N1 segment in one row,based on the delimiter X'25',which comes at the end of each ISA,GS,N1 and I want only these 3 segments.The main thing here is ISA,GS,N1 segments will not come in the same position every time in a transaction.I tried using PARSE,when=group,records=2.But the ISA's which are extending upto 3 columns are getting missed out,as I have tried to group only 2 records.So can you please give me a solution for this through ICETOOL/DFSORT.

The other details are the input file can be fixed or variable block file.
Please provide me the solution.
_________________
Y.Bhavana

DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: Arun Raj
Posted: Fri Dec 09, 2016 11:32 am (GMT 5.5)

Hello,

Welcome to the forums!

The input data posted above is not so clear (at least to me). Are these different records? Can you show what you have tried, and what is your expected output for the above input? And you mentioned the input data set can either be fixed or be variable - but which one are you working with?

When you post sample data or code, please use the "Code" tags and "Preview" before posting to make sure it looks the way you expected.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard

DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: bhavana yalavarthi
Posted: Fri Dec 09, 2016 1:47 pm (GMT 5.5)

Yes,they are of different records.Iam dealing with both FB and VB files.So can you plz help me with the code that will work for both FB & VB files.


Code:
ISA*00*          *00*          *01*078769021      *16*054481205CPIC  *16
9*U*00301*000000061*0*P*~ GS*PS*078769021*054481205*161111*0229*61*X*003
30*610001 BFR*00**161110*DL*A*170201*170301*161110 N1*MI*Toyota Tsusho A
Inc.*92*311 LIN**VP*766325AA0AC*PO*20212149 UIT*LB PID*F*9B***CR SP122B
7.01 SDP*Y*Y FST*119049.642*C*D*170301**002*0229*DO*20212149 SDP*Y*Y FST
2*D*D*170401**002*0229*DO*20212149 LIN**VP*781985AA0AC*PO*20212149 UIT*L
9B***GA SP781B .039 X 61.73 SDP*Y*Y FST*62986.07911*C*D*170301**002*0229
2149 SDP*Y*Y FST*74957.182*D*D*170401**002*0229*DO*20212149 LIN**VP*7811
PO*20212149 UIT*LB PID*F*9B***CR SP123B .028 X 57.01 SDP*Y*Y FST*39683.2
70301**002*0229*DO*20212149 SDP*Y*Y FST*66138.69*D*D*170401**002*0229*DO
9 LIN**VP*781865AA0AC*PO*20212149 UIT*LB PID*F*9B***CR SP123B .047 X 49.



The expected output is,
Code:
ISA*00**00**01*078769021*16*054481205CPIC*161111*0229*U*00301*000000061*
GS*PS*078769021*054481205*161111*0229*61*X*003010                       
ST*830*610001                                                           
N1*MI*ToyotaTsushoAmerica,Inc.*92*311                                   
ISA*00**00**01*017093972*16*054481205CPIC*161110*0320*U*00300*000000095*
GS*PS*0000000282*054481205*161110*0320*95*X*003010                     
ST*830*950001                                                           
N1*MI*MILLSTEELCOMPANY*92*0000000282                                   
ISA*00**00**01*112064324*16*054481205CPIC*161108*1452*X*00300*000000157*
GS*PS*000000195*054481205*161108*1452*157*X*003010                     
ST*830*000000272                                                       
N1*MI*MI-TECHSTEEL-DECATUR,AL.*92*33                                   
ISA*00**00**01*884601162*16*054481205CPIC*161108*1453*X*00300*000000105*
GS*PS*884601162*054481205*161108*1453*105**003010                       
ST*830*000000272                                                       
N1*MI*STEELTECHNOLOGIES-GHENT,KY*92*262                                 



These ISA,GS and N1 segments will not start at the same position in every transaction.We have to make ISA segment to come in 1 row,GS segment to come in 1 row and N1 to come in 1 row based on delimiter X'25'.
_________________
Y.Bhavana

DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: bhavana yalavarthi
Posted: Fri Dec 09, 2016 2:56 pm (GMT 5.5)

Can you please provide me the solution atleast for FB files as of now.I await your response.icon_smile.gif
_________________
Y.Bhavana

DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: Arun Raj
Posted: Fri Dec 09, 2016 3:29 pm (GMT 5.5)

Before we get into the code, I am not sure if this is the right tool to deal with your problem. Was this data sent to mainframe from some external source and got "wrapped" by mistake at the source and you're trying to unwrap after receiving it? If yes, you'd be better off fixing it at the source. Where are you getting this data set from?

Are u removing embedded blanks too?

Quote:
Can you please provide me the solution atleast for FB files as of now.I await your response.
I don't think anybody will be willing to do the "work" for you on a public forum and note that getting impatient is not a good thing to do when people respond during their free time, free of cost.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard

DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: Nic Clouston
Posted: Fri Dec 09, 2016 3:31 pm (GMT 5.5)

Quote:
Can you please provide me the solution atleast for FB files as of now.I await your response.

You may wait a long time especially after posts like that quoted. Responses are made by volunteers who have their own jobs to do and attend to forum matters only when they feel so inclined.

And get your terminology correct - they are data sets not files. And do not use 'plz', the word is please.
_________________
Regards
Nic

DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: bhavana yalavarthi
Posted: Fri Dec 09, 2016 3:33 pm (GMT 5.5)

Hi the source data will itself be like this,which we will get by copying all the gdg versions into single o/p dataset,all the GDG versions also will contain the data like this.No Iam not removing the blanks.
_________________
Y.Bhavana


DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: Arun Raj
Posted: Fri Dec 09, 2016 3:46 pm (GMT 5.5)

Quote:
No I am not removing the blanks.
You are, at least in the example you showed above.

I guess you meant "generations" and not "versions". AFAIK there is no magic code that works for both FB and VB data sets. Sort products treat FB and VB data sets differently and so does the sort control statements.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard

DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: bhavana yalavarthi
Posted: Fri Dec 09, 2016 3:46 pm (GMT 5.5)

Sorry Nic and Arun.I will wait for your response.
_________________
Y.Bhavana

DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: bhavana yalavarthi
Posted: Fri Dec 09, 2016 3:48 pm (GMT 5.5)

Yes they are generations.Ok can you please help me for FB datasets.
_________________
Y.Bhavana

DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: prino
Posted: Fri Dec 09, 2016 3:49 pm (GMT 5.5)

bhavana yalavarthi wrote:
Hi the source data will itself be like this,which we will get by copying all the gdg versions into single o/p dataset.

And where the flipping 'ell do these GDG's come from? Spontaneous generation I presume?

Write a flipping COBOL program and be done with it!
_________________
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here... icon_smile.gif

DFSORT/ICETOOL :: RE: Unwrap the data based on delimiter X'25'

$
0
0
Author: Bill Woodger
Subject: Reply to: Unwrap the data based on delimiter X'25'
Posted: Fri Dec 09, 2016 3:50 pm (GMT 5.5)

From the sample, we can't tell what is a space and what is an X'25'. Can you "represent" the X'25' just for the sample? Is there a minimum or maximum data-length? Record-length?

I agree with Arun. X'25' looks very much like it has come from "somewhere else" and the data has been pickled somewhere in the process. Your data didn't just "appear" on GDGs, that would be magic, not computing.

Viewing all 8500 articles
Browse latest View live